Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to leave an argument out of the help using python argparse

I have an argument that is an internal debug flag and shouldn't be run by users who don't know what they are doing. I realize that hiding it is in essence security by obscurity, but I'm not concerned about malice so much as incompetence. Optparse had a SUPPRESS_HELP option, is there and argparse equivalent?

like image 259
Gordon Wrigley Avatar asked Aug 18 '11 05:08

Gordon Wrigley


1 Answers

parser.add_argument('--secret', help=argparse.SUPPRESS)

From here: http://argparse.googlecode.com/svn/trunk/doc/argparse-vs-optparse.html

First Google result for argparse suppress_help, by the way.

like image 75
kindall Avatar answered Oct 18 '22 05:10

kindall