-
Notifications
You must be signed in to change notification settings - Fork 480
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
Verb aliases #636
Verb aliases #636
Conversation
I wasn't sure how best to update the Help messages generated to indicate the new alias support. If anyone has suggestions for what they'd like to see and I can update |
Update helptext here |
Thanks for your work and fixing #6 |
Help messages updated and tested. Let me know if you think any changes are needed. |
@johnjaylward |
9ee6962
to
5afbdda
Compare
@moh-hassan , I finished the rebase, but I don't think I need to remove the "Default Verb" setting. I set up the test case purposefully to take into account a default verb. If I remove that option, I will need to adjust my test cases accordingly. |
@moh-hassan , I ended up making a few more test cases which show that it work both with a default verb and without a default verb. Also added a few comments to show intention of the tests. |
d84106a
to
46938c1
Compare
@moh-hassan I'm working on a PR to introduce sub verbs into the library. Changing the call to E.g. something like this OptionSpecification.NewSwitch(
string.Empty,
new[] { verbTuple.Item1.Name }.Concat(verbTuple.Item1.Aliases).ToDelimitedString(", "),
false,
verbTuple.Item1.IsDefault ? "(Default Verb) " + verbTuple.Item1.HelpText : verbTuple.Item1.HelpText, //Default verb
string.Empty,
verbTuple.Item1.Hidden); Just thought I'd mention it before 2.9 is released in case it is a problem. |
@twaalewijn
Can this may to related to the Configuration of Git to handle line endings? Can Your suggestion cause some tests to fail? |
@moh-hassan As can be seen in the diff the first parameter (short name) used to be After passing both the verb name and possible aliases to the long name parameter as shown in my earlier example my expected help text was indented/aligned like it was before this PR.
I guess I cannot 100% rule that out but I do not think so.
It will cause these instances of theory tests to fail:
But these tests are expecting wrong outputs I think. It isn't very easy to see in the InlineData of lines 163 and 170 but in the data of lines 88 and 96 you can see that the help text for The data of line 88 for example currently looks like this: [InlineData("--help", true, new string[]
{
"copy, cp, cpy (Default Verb) Copy some stuff",
"move, mv",
"delete Delete stuff",
"help Display more information on a specific command.",
"version Display version information.",
})] But should have looked like this instead: [InlineData("--help", true, new string[]
{
"copy, cp, cpy (Default Verb) Copy some stuff",
"move, mv",
"delete Delete stuff",
"help Display more information on a specific command.",
"version Display version information.",
})] |
@twaalewijn, I see. The reason I swapped the verb to the "short" position was to ensure it would always be first in the list. When the verb was in the "long" position, it changed the order to have all the aliases first, which I did not like. The [InlineData("--help", true, new string[]
{
"cp, cpy, copy (Default Verb) Copy some stuff",
"mv, move",
"delete Delete stuff",
"help Display more information on a specific command.",
"version Display version information.",
})] |
Fixes #6
Fixes #517