-1

argparse offers very comprehensive 'canned' solution for processing argument. However, is it possible to set any secret options? like some options to display debug info, and these options will not be showing in the usage or help message?

like:

usage: myprog action [-v | -r | -s]

myprog report -debugging

the debugging mode : enabled...
timeislove
  • 1,075
  • 1
  • 9
  • 14
  • 1
    I Googled your question and the first result is a [helpful question and answer on StackOverflow](http://stackoverflow.com/questions/11114589/creating-hidden-arguments-with-python-argparse) showing how to do exactly this. – Two-Bit Alchemist Mar 19 '14 at 03:14

1 Answers1

2

Set the argument's help option to argparse.SUPPRESS:

parser.add_argument('--debugging', help=argparse.SUPPRESS)
grayshirt
  • 615
  • 4
  • 13