-
Notifications
You must be signed in to change notification settings - Fork 293
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 option help is not rendering Enum value options #246
Comments
📎 Please read: #250. Thanks for collaboration and patience! 😅 |
This error appears to be in the TryParseHelpVerb method where the verb is fetched as the first item of the args parameter but for "help" the verb should be the second item. e.g. "myapp help commit" where "commit" is the verb. The following line shows where it fetches the first item of args. var verb = args.FirstOrDefault(); To prove my point, the following "if" statement looks for "help" in args[0] and will return if it does not find it as shown below: if (string.Compare(args[0], helpInfo.Right.LongName, GetStringComparison(_settings)) == 0) Below is the complete method. private bool TryParseHelpVerb(string[] args, object options, Pair<MethodInfo, HelpVerbOptionAttribute> helpInfo, OptionMap optionMap)
{
var helpWriter = _settings.HelpWriter;
if (helpInfo != null && helpWriter != null)
{
if (string.Compare(args[0], helpInfo.Right.LongName, GetStringComparison(_settings)) == 0)
{
// User explicitly requested help
var verb = args.FirstOrDefault();
if (verb != null)
{
var verbOption = optionMap[verb];
if (verbOption != null)
{
if (verbOption.GetValue(options) == null)
{
// We need to create an instance also to render help
verbOption.CreateInstance(options);
}
}
}
DisplayHelpVerbText(options, helpInfo, verb);
return true;
}
}
return false;
} I'm unable to get the time to test my theory or even come up with a fix but most likely I would do something like: var verb = args.Skip(1).FirstOrDefault(); |
Enum parsing with verbs as positional arguments is also currently case sensitive when I don't believe it should be. |
@DanHarman I agree. See: #326 |
When I create a verb object with a verb that has an enum value option, the help for the verb is not rendering. See example here: https://gist.github.com/kensykora/f486cdf239a823390409
Basically, any enum that's a positional parameter doesn't show up in autobuild help. It'd also be nice if the enum displayed it's string value rather than the int value, maybe even used the System.ComponentModel.DescriptionAttribute option?
The text was updated successfully, but these errors were encountered: