class OptionParser: (source)
The option parser is an internal class that is ultimately used to parse options and arguments. It's modelled after optparse and brings a similar but vastly simplified API. It should generally not be used directly as the high level Click classes wrap it for you. It's not nearly as extensible as optparse or argparse as it does not implement features that are implemented on a higher level (such as types or defaults). :param ctx: optionally the :class:`~click.Context` where this parser should go with.
Method | __init__ |
Undocumented |
Method | add |
Adds a positional argument named `dest` to the parser. |
Method | add |
Adds a new option named `dest` to the parser. The destination is not inferred (unlike with optparse) and needs to be explicitly provided. Action can be any of ``store``, ``store_const``, ``append``, ``append_const`` or ``count``. |
Method | parse |
Parses positional arguments and returns ``(values, args, order)`` for the parsed options and arguments as well as the leftover arguments if there are any. The order is a list of objects as they appear on the command line... |
Instance Variable | allow |
Undocumented |
Instance Variable | ctx |
Undocumented |
Instance Variable | ignore |
Undocumented |
Method | _get |
Undocumented |
Method | _match |
Undocumented |
Method | _match |
Undocumented |
Method | _process |
Undocumented |
Method | _process |
Undocumented |
Method | _process |
Undocumented |
Instance Variable | _args |
Undocumented |
Instance Variable | _long |
Undocumented |
Instance Variable | _opt |
Undocumented |
Instance Variable | _short |
Undocumented |
Adds a positional argument named `dest` to the parser. The `obj` can be used to identify the option in the order list that is returned from the parser.
Parameters | |
obj:CoreArgument | Undocumented |
dest:t.Optional[ | Undocumented |
nargs:int | Undocumented |
Adds a new option named `dest` to the parser. The destination is not inferred (unlike with optparse) and needs to be explicitly provided. Action can be any of ``store``, ``store_const``, ``append``, ``append_const`` or ``count``. The `obj` can be used to identify the option in the order list that is returned from the parser.
Parameters | |
obj:CoreOption | Undocumented |
opts:t.Sequence[ | Undocumented |
dest:t.Optional[ | Undocumented |
action:t.Optional[ | Undocumented |
nargs:int | Undocumented |
const:t.Optional[ | Undocumented |
Parses positional arguments and returns ``(values, args, order)`` for the parsed options and arguments as well as the leftover arguments if there are any. The order is a list of objects as they appear on the command line. If arguments appear multiple times they will be memorized multiple times as well.
Parameters | |
args:t.List[ | Undocumented |
Returns | |
t.Tuple[ | Undocumented |
Undocumented
Parameters | |
optionstr | Undocumented |
option:Option | Undocumented |
state:ParsingState | Undocumented |
Returns | |
t.Any | Undocumented |
Undocumented
Parameters | |
opt:str | Undocumented |
explicitt.Optional[ | Undocumented |
state:ParsingState | Undocumented |