BJ Dierkes added the comment: I would like to add to this regarding the following:
[QUOTE] Why would a user want to use `help=argparse.SUPPRESS`, as opposed to simply omitting the `help` parameter? The effect would be the same as your patch. [/QUOTE] This actually isn't the case, if you omit the 'help' option entirely, the sub-parser is still listed in the {short_list}. For example: import argparse root_parser = argparse.ArgumentParser(prog='myapp') root_parser.add_argument('--foo', action=CustomAction) sub_parsers = root_parser.add_subparsers(dest='commands', title='subcommands') sub_parser = sub_parsers.add_parser('sub-command-1', help='useless help txt') sub_parser = sub_parsers.add_parser('sub-command-2', help=argparse.SUPPRESS) sub_parser = sub_parsers.add_parser('sub-command-3') args = root_parser.parse_args() You end up with: $ python argtest.py --help usage: myapp [-h] [--foo FOO] {sub-command-1,sub-command-2,sub-command-3} ... optional arguments: -h, --help show this help message and exit --foo FOO subcommands: {sub-command-1,sub-command-2,sub-command-3} sub-command-1 useless help txt sub-command-2 ==SUPPRESS== The 'sub-command-3' is still listed in the {sub-parsers} .... where, if I want to hide a sub-parser... I don't want to see it anywhere. Would be ideal to have a 'hide=True' option for sub-parsers and arguments alike. All the same functionality, you just wouldn't see it in '--help'. ---------- nosy: +derks _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22848> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com