CLI11 icon indicating copy to clipboard operation
CLI11 copied to clipboard

add read and write file validators #249

Open rafiw opened this issue 6 years ago • 12 comments

Will close #249.

rafiw avatar Mar 04 '19 13:03 rafiw

Codecov Report

Merging #250 into master will decrease coverage by 0.03%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #250      +/-   ##
==========================================
- Coverage     100%   99.96%   -0.04%     
==========================================
  Files          12       12              
  Lines        2566     2570       +4     
==========================================
+ Hits         2566     2569       +3     
- Misses          0        1       +1
Impacted Files Coverage Δ
include/CLI/Validators.hpp 99.68% <83.33%> (-0.32%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update be8a08f...6f88e6c. Read the comment docs.

codecov[bot] avatar Mar 04 '19 14:03 codecov[bot]

Codecov Report

Merging #250 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #250    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          12     12            
  Lines        3397   2786   -611     
======================================
- Hits         3397   2786   -611
Impacted Files Coverage Δ
include/CLI/Validators.hpp 100% <100%> (ø) :arrow_up:
include/CLI/Formatter.hpp 100% <0%> (ø) :arrow_up:
include/CLI/Option.hpp 100% <0%> (ø) :arrow_up:
include/CLI/App.hpp 100% <0%> (ø) :arrow_up:
include/CLI/StringTools.hpp 100% <0%> (ø) :arrow_up:
include/CLI/TypeTools.hpp 100% <0%> (ø) :arrow_up:
include/CLI/Split.hpp 100% <0%> (ø) :arrow_up:
include/CLI/ConfigFwd.hpp 100% <0%> (ø) :arrow_up:
include/CLI/Error.hpp 100% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d9379cc...bef2388. Read the comment docs.

codecov[bot] avatar Mar 04 '19 14:03 codecov[bot]

@henryiii if you agree with this approach i will add tests

rafiw avatar Mar 04 '19 14:03 rafiw

CLI::ExistingReadableFile And ...Writable... look like better names I think, but otherwise I like the way you’ve added it! +1

henryiii avatar Mar 04 '19 23:03 henryiii

Will close #249.

henryiii avatar Mar 12 '19 08:03 henryiii

@henryiii the permissions in windows is different then the linux once. that why the test fails. How do you want to approach this?

rafiw avatar Jun 12 '19 08:06 rafiw

What is the plan with this PR? Continue working on it or close it? I can also try to pick up the work

cbachhuber avatar Dec 01 '19 20:12 cbachhuber

the issue is with windows since the permissions there is more complicated. i can put the windows test under ifdef so it will pass. is this ok?

rafiw avatar Dec 02 '19 08:12 rafiw

This would need to be made to work with the changes from #341. For C++17 that enables the use of filesystem so it might be a little easier in C++17 mode on windows now.

phlptp avatar Dec 02 '19 14:12 phlptp

Right, but we would still need to enable file handling (and therefore, this feature) for windows under C++11, correct? Consequently, I would prefer to implement it for Windows & C++11 and not put the test under ifdef. What do you think?

cbachhuber avatar Dec 02 '19 18:12 cbachhuber

i will take another look on this and add C++17 support as well

rafiw avatar Dec 03 '19 07:12 rafiw

@henryiii this and a few other issues about validators indicate that some additional validators are of interest. The balance here is that the Validators can take time to compile so for simple applications that don't use them that is a lot of non useful code that needs to compile that must be balanced with the high utility of the additional Validators for those that use them.

What I am wondering if it makes sense to split the Validators into two pieces. The basic definition is required for CLI11, but many of the specific validators and all the machinery that goes with them could be split into a separate file that possibly is even not included in the single file header. Then a separate Validators.hpp would define a library of additional validators, that if someone wanted it they could include that header as well. With the exception of the underlying filesystem operations none of the validators are required by the rest of CLI11. So apart from the basic definition and maybe a couple of the most common validators, the library could be split without issue for 2.0. Then we could get these validators in and some of the other issues without an increasing impact on the compile time.

phlptp avatar Jan 22 '20 17:01 phlptp