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

Add support for long help or additional 'help' flags, or both. #670

Closed
henvic opened this issue Apr 11, 2018 · 3 comments
Closed

Add support for long help or additional 'help' flags, or both. #670

henvic opened this issue Apr 11, 2018 · 3 comments

Comments

@henvic
Copy link

henvic commented Apr 11, 2018

I want to add a --long-help flag (with -H shortcut) that will show a longer help.
This could easily be done with support for marking additional help flags or by letting the user choose a set of flags and shorthands to use for help.

I'd have to parse the flags separately and set the help flag programmatically whenever I find a -H or --long-help flag. I have tried to work around this with a 'persistent run' structure but it is just too much code and doesn't work when PositionalArgs that requires a minimum number of arguments is in use.

See:

cobra/command.go

Lines 694 to 696 in 4dab30c

// If help is called, regardless of other flags, return we want help.
// Also say we need help if the command isn't runnable.
helpVal, err := c.Flags().GetBool("help")

@CreatCodeBuild
Copy link

I have also noticed that auto generated doc doesn't contain long description of Long field of a cmd struct.

@github-actions
Copy link

This issue is being marked as stale due to a long period of inactivity

@johnSchnake
Copy link
Collaborator

There wasn't much traction on this issue and its quite old. Going to close as part of #1600 but if this is still something you struggle with feel free to reopen.

If I understand you correctly, you just want the ability to mark other flags so they have the same high priority as the existing --help which will short circuit other logic. If its not still an issue, disregard my question.

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

3 participants