Consider the following:
parser.add_option("-f", "--file", "--secret", action = "append", type = "string", dest = "filename", default = [], help = "specify the files")
I would like to hide the --secret option from the user when help is invoked. Can I do this in the following way?
parser.add_option("-f", "--file", action = "append", type = "string", dest = "filename", default = [], help = "specify the files")
parser.add_option("--secret", action = "append", type = "string", dest = "filename", default = [], help = "specify the files")
Am I missing any hidden issue by doing so?If so, can anyone suggest an alternative way to achieve this.
Try the help=SUPPRESS_HELP
trick (see docs):
from optparse import OptionParser, SUPPRESS_HELP
parser.add_option("-f", "--file", action = "append", type = "string", dest = "filename", default = [], help = "specify the files")
parser.add_option("--secret", action = "append", type = "string", dest = "filename", default = [], help=SUPPRESS_HELP)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With