Skip to content
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

HelpOption display bug #307

Closed
tomrus88 opened this issue Nov 16, 2019 · 1 comment · Fixed by #323
Closed

HelpOption display bug #307

tomrus88 opened this issue Nov 16, 2019 · 1 comment · Fixed by #323
Labels
bug good first issue This seems like a good issue if you're a new contributor. help wanted We would be willing to take a well-written PR to help fix this.

Comments

@tomrus88
Copy link

tomrus88 commented Nov 16, 2019

Describe the bug
Help text is missing option name when using default short help template like this

[HelpOption("-h")]
abstract class SomeCommandBase
{
    protected virtual int OnExecute(CommandLineApplication app)
    {
        app.ShowHelp();
        return 1;
    }
}

[Command("somecmd")]
class MyApp : SomeCommandBase
{
}

You get following help texts:

Run 'appname [command] --' for more information about a command.

instead of

Run 'appname [command] -h' for more information about a command.

and

Specify - for a list of available options and commands.

instead of

Specify -h for a list of available options and commands.

Issue seems to be somewhere in those lines:
https://github.com/natemcmaster/CommandLineUtils/blob/master/src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs#L281
https://github.com/natemcmaster/CommandLineUtils/blob/master/src/CommandLineUtils/CommandLineApplication.cs#L994

Also please consider making CommandOption.UnderlyingType and DefaultHelpTextGenerator.ExtractNamesFromEnum protected to make creating custom help generators easier.

@tomrus88 tomrus88 added the bug label Nov 16, 2019
@natemcmaster natemcmaster added good first issue This seems like a good issue if you're a new contributor. help wanted We would be willing to take a well-written PR to help fix this. labels Nov 19, 2019
@natemcmaster
Copy link
Owner

Looks like a simple bug. I would be happy to accept a pull-request to fix the issue.

Re: CommandOption.UnderlyingType - this one is intentionally internal because I plan to refactor how it is used relatively soon. I don't want to risk someone taking a dependency on this API by making it accessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue This seems like a good issue if you're a new contributor. help wanted We would be willing to take a well-written PR to help fix this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants