module documentation

This module started out as largely a copy paste from the stdlib's optparse module with the features removed that we do not need from optparse because we implement them in Click on a higher level (for instance type handling, help formatting and a lot more). The plan is to remove more and more from here over time. The reason this is a different module and not optparse from the stdlib is that there are differences in 2.x and 3.x about the error messages generated and optparse in the stdlib uses gettext for no good reason and might cause us issues. Click uses parts of optparse written by Gregory P. Ward and maintained by the Python Software Foundation. This is limited to code in parser.py. Copyright 2001-2006 Gregory P. Ward. All rights reserved. Copyright 2002-2006 Python Software Foundation. All rights reserved.

Class Argument Undocumented
Class Option Undocumented
Class OptionParser 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.
Class ParsingState Undocumented
Function normalize_opt Undocumented
Function split_arg_string Split an argument string as with :func:`shlex.split`, but don't fail if the string is incomplete. Ignores a missing closing quote or incomplete escape sequence and uses the partial token as-is.
Function split_opt Undocumented
Constant V Undocumented
Function _unpack_args Given an iterable of arguments and an iterable of nargs specifications, it returns a tuple with all the unpacked arguments at the first index and all remaining arguments as the second.
Variable _flag_needs_value Undocumented
def normalize_opt(opt, ctx): (source)

Undocumented

Parameters
opt:strUndocumented
ctx:t.Optional[Context]Undocumented
Returns
strUndocumented
def split_arg_string(string): (source)

Split an argument string as with :func:`shlex.split`, but don't fail if the string is incomplete. Ignores a missing closing quote or incomplete escape sequence and uses the partial token as-is. .. code-block:: python split_arg_string("example 'my file") ["example", "my file"] split_arg_string("example my\") ["example", "my"] :param string: String to split.

Parameters
string:strUndocumented
Returns
t.List[str]Undocumented
def split_opt(opt): (source)

Undocumented

Parameters
opt:strUndocumented
Returns
t.Tuple[str, str]Undocumented

Undocumented

Value
t.TypeVar('V')
def _unpack_args(args, nargs_spec): (source)

Given an iterable of arguments and an iterable of nargs specifications, it returns a tuple with all the unpacked arguments at the first index and all remaining arguments as the second. The nargs specification is the number of arguments that should be consumed or `-1` to indicate that this position should eat up all the remainders. Missing items are filled with `None`.

Parameters
args:t.Sequence[str]Undocumented
nargs_spec:t.Sequence[int]Undocumented
Returns
t.Tuple[t.Sequence[t.Union[str, t.Sequence[t.Optional[str]], None]], t.List[str]]Undocumented
_flag_needs_value = (source)

Undocumented