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

Show usage description when using help for option commands as well #31

Closed
kdawgwilk opened this issue Jan 31, 2017 · 5 comments
Closed

Comments

@kdawgwilk
Copy link

It would be nice if prompting for the usage description was consistent for different types of commands. In some places you can type cmd help and other times you have to type cmd subCommand -h. It isn't consistent and can confuse the user IMO.

@jakeheis
Copy link
Owner

jakeheis commented Feb 5, 2017

Could you explain what you mean by this a little bit more? I'm not sure I totally understand what you're saying

@kdawgwilk
Copy link
Author

It would be better if -h and help were interchangeable but it doesn't appear to be this way.

e.g.

Attempting to use help on a subcommand is not an acceptable way to show the usage description.

@jakeheis
Copy link
Owner

While I agree it would be nice to make this more consistent, a change like this would make it impossible to pass 'help' as an argument to a function. For example, if you were implementing a CLI like git and had a file named 'help', you would be unable to run mygit add help. Since this feature would interfere with the workings of commands, I think it's best to not implement it.

@kdawgwilk
Copy link
Author

I am fine with not using help but at least allow -h to be used everywhere.

@jakeheis
Copy link
Owner

-h should work everywhere:

public protocol OptionCommand: Command {
    
     ...

    /// Whether help for the command should be shown when -h is passed. Default is true.
    var helpOnHFlag: Bool { get }

    ...

}

If -h isn't working for your commands, then that's a bug that I would love to fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants