The following option attributes may be passed as keyword argumentstoparser.add_option(). If you pass an option attributethat is not relevant to a particular option, or fail to pass a requiredoption attribute,optparse raises OptionError.
"store")Determinesoptparse's behaviour when this option is seen on the commandline; the available options are documented above.
"string")The argument type expected by this option (e.g.,"string" or"int"); the available option types are documented below.
If the option's action implies writing or modifying a value somewhere,this tellsoptparse where to write it:dest names an attribute of theoptions object thatoptparse builds as it parses the command line.
default (deprecated)The value to use for this option's destination if the option is notseen on the command line. Deprecated; useparser.set_defaults()instead.
nargs (default: 1)How many arguments of typetype should be consumed when thisoption is seen. If > 1,optparse will store a tuple of values todest.
constFor actions that store a constant value, the constant value to store.
choicesFor options of type"choice", the list of strings the usermay choose from.
callbackFor options with action"callback", the callable to call when thisoption is seen. See section 14.3.4, Option Callbacks for detail on the argumentspassed tocallable.
callback_args,callback_kwargsAdditional positional and keyword arguments to pass tocallbackafter the four standard callback arguments.
Help text to print for this option when listing all available optionsafter the user supplies ahelp option (such as--help).If no help text is supplied, the option will be listed without helptext. To hide this option, use the special valueSUPPRESS_HELP.
metavar (default: derived from option strings)Stand-in for the option argument(s) to use when printing help text.See section 14.3.2, the tutorial for an example.