You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ssh, tar, and other common tools allow for multiple non-option-argument options and act on their total count. (Implementing this with getopt is pretty trivial).
e.g. tar -cvf and tar -cvvf produce different output.
Is there a way to do this with CommandLine? I did not see anything promising in the documentation or examples/source code I perused, but I may have missed something.
(This might just be related to #594, but the issue there seems to be with repeated options with required option-arguments)
The text was updated successfully, but these errors were encountered:
PR #607 (not yet merged) includes a feature that would enable the use of -vv and similar repeated non-option-argument options. It adds a new Option property called FlagCounter, which should be set on an int property:
This will be 0 if the -v option was not passed, 1 if -v was passed, 2 if -vv or -v -v was passed, and so on. If you want dueling --verbose and --quiet options, you could do it like this:
[Option('v',"--verbose", FlagCounter=true)]int Verbose {get;set;}[Option('q',"--quiet", FlagCounter=true)]int Quiet {get;set;}int Verbosity =>Verbose-Quiet;// C# 6 and up, see https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/expression-bodied-members#read-only-properties
BTW, if you want to see #607 merged sooner, stop by #601 and express your opinion of whether CommandLineParser should follow the GNU standards (mixed options and non-option arguments by default) or the POSIX standards (stop processing after you find the first non-option argument) by default. That's the current sticking point that's delaying #607 getting merged.
ssh, tar, and other common tools allow for multiple non-option-argument options and act on their total count. (Implementing this with getopt is pretty trivial).
e.g.
tar -cvf
andtar -cvvf
produce different output.Is there a way to do this with CommandLine? I did not see anything promising in the documentation or examples/source code I perused, but I may have missed something.
(This might just be related to #594, but the issue there seems to be with repeated options with required option-arguments)
The text was updated successfully, but these errors were encountered: