[issue12686] argparse - add 'hide' feature

BJ Dierkes report at bugs.python.org
Wed Aug 3 09:23:41 CEST 2011


New submission from BJ Dierkes <wdierkes at gmail.com>:

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').

----------
components: None
messages: 141601
nosy: derks
priority: normal
severity: normal
status: open
title: argparse - add 'hide' feature
type: feature request

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12686>
_______________________________________


More information about the Python-bugs-list mailing list