suppress one of the options from help when using optparse in python -
consider following:
parser.add_option("-f", "--file", "--secret", action = "append", type = "string", dest = "filename", default = [], = "specify files")
i hide --secret option user when invoked. can in following way?
parser.add_option("-f", "--file", action = "append", type = "string", dest = "filename", default = [], = "specify files") parser.add_option("--secret", action = "append", type = "string", dest = "filename", default = [], = "specify files")
am missing hidden issue doing so?if so, can suggest alternative way achieve this.
try help=suppress_help
trick (see docs):
from optparse import optionparser, suppress_help parser.add_option("-f", "--file", action = "append", type = "string", dest = "filename", default = [], = "specify files") parser.add_option("--secret", action = "append", type = "string", dest = "filename", default = [], help=suppress_help)
Comments
Post a Comment