-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-instance option support #594
Add multi-instance option support #594
Conversation
d846fb5
to
78171b0
Compare
This also helps with a command line like:
versus
with options like class CompressOptions
{
[Option('i', "include", Required = false, HelpText = "Include patterns.")]
public IEnumerable<string> IncludePatterns { get; set; }
[Value(0, MetaName = "BaseDir", Required = true, HelpText = "Directory to be compressed.")]
public string BaseDir { get; set; }
} The second one breaks since it will not assign the last value to the BaseDir option. |
@ericnewton76, any chance this could be included in v2.8.0? |
I'm waiting for this as well. |
Also wouldn't it be better to add this as a per-option option? Or allow both methods, where the option added by the PR work on a global scale. |
@moh-hassan I have some time to work on this now, so I'll look into that test failure and let you know what I find. |
@moh-hassan Done. I opened a new PR since I don't seem to be able to re-open this one after GitHub thinks it was already merged. #678 is this PR, rebased onto the current state of the |
@moh-hassan BTW, my next plan is to rewrite #607 so that it is controlled by a Parser option. I'm thinking that I'll call the option GetoptMode. It will be off by default so that the current behavior of CommandLineParser is unchanged, but turning it on will enable strict getopt compatibility (in getopt's default mode, i.e. as if POSIXLY_CORRECT is turned off in getopt). In particular, turning on GetoptMode will cause Do you plan to do a 2.9 release right away and I should expect to get GetoptMode into 2.10 but not 2.9? Or is the 2.9 release still at least 3-4 days off so I'll have time to get GetoptMode implemented and PR'ed? |
@moh-hassan - GetoptMode PR is done: #684. Note that #682 should be merged first before #684. Once #682 is merged, I'll rebase #684 on top of the new state of the |
@moh-hassan - And I've finished rebasing #608 on top of |
#357 is a request for supporting multiple occurrences of the same parameter and collecting those into an enumerable, e.g. "myprog -i file1 -i file2 -i file3" would parse as having the
-i
parameter with three values, file1, file2 and file3. @tydunkel created an implementation of this feature, but never (AFAICT) created a PR for it. This PR is @tydunkel's code, rebased onto the currentdevelop
branch.Note that when I run this, I get some spurious unit test failures and some real failures. The spurious failures I'm getting are caused by #403, but the real failures I'm getting all have the same pattern: the "ERROR(S)" section of the output is repeated twice. E.g., this test expects the parser to output:
and instead it's outputting:
I don't have time right now to track down why the error output is being duplicated. But all the unit test failures I could see look like they're the same thing, so once that single bug is located and fixed, the tests should all pass.
Hopefully this will be helpful to someone to be able to move forward with implementing #357 (and #522 which is a dupe of #357).