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
argparse - document (and improve?) use of SUPPRESS with help= #56895
Comments
Having the ability to 'hide' positional/option arguments and subparsers in argparse would be useful. For example, I might want to add a subparser for 'somecommand-help' which would be a commands specifically for displaying help output of 'somecommand'. There is no reason I'd want to display this as an available argument... but rather simply add to the description "For more info try <command>-help". Something like: parser = argparse.ArgumentParser()
sub = parser.add_subparsers()
somecommand_help = sub.add_parser('somecommand-help', hide=True) OR parser.add_argument('--some-crazy-option', hide=True). It would then not display in the '--help' output, but would still function when 'somecommand-help' or '--some-crazy-option' is passed at command line. Would also be an extra bonus to add some sort of interface to 'list_hidden_arguments'). |
This is partly a doc issue, but there also appear to be bugs in the way the existing functionality works (although it is hard to tell for sure since it isn't documented :) Try using the value argparse.SUPPRESS as the value of help= in various places and you'll see what I mean. |
Could you give some examples of bugs that you observed? Otherwise, this looks like a duplicate of bpo-9349. The intention is that help=SUPPRESS should cause the given argument to not be displayed in the help message. If there are cases where that's not true, then it's definitely a bug. |
Can this be closed? |
Yeah, looks like we can close this. If anyone finds a specific bug in the use of SUPPRESS, please open a new issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: