Docs: add references for varargs and kwargs (#2281)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Blazej Michalik · committed by GitHub · parent 8473b3c · Browse files · 2 files·+18 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+18 added−1 removed
- other:+18 added−1 removed
Provenance
- Commit
77838f8- Tree
42e0358- Author
Blazej Michalik <6691643+MrMino@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
8473b3c
2 files changed+18 added−1 removed
modified:src/click/core.py+6 added-1 removed
1478 unmodified lines1479 multiple commands to be chained together.1480 :param result_callback: The result callback to attach to this multi1481 command. This can be set or changed later with the1482 :meth:`result_callback` decorator.1483+ :param attrs: Other command arguments described in :class:`Command`.1484 """1485 1486 allow_extra_args = True1487 allow_interspersed_args = False458 unmodified lines1946 """A command collection is a multi command that merges multiple multi1947 commands together into one. This is a straightforward implementation1948 that accepts a list of different multi commands as sources and1949 provides all the commands for each of them.1950+1951+ See :class:`MultiCommand` and :class:`Command` for the description of1952+ ``name`` and ``attrs``.1953 """1954 1955 def __init__(1956 self,515 unmodified lines2472 variable in case a prefix is defined on the2473 context.2474 :param help: the help string.2475 :param hidden: hide this option from help outputs.2476+ :param attrs: Other command arguments described in :class:`Parameter`.2477 2478 .. versionchanged:: 8.1.02479 Help text indentation is cleaned here instead of only in the2480 ``@option`` decorator.470 unmodified lines2951 """Arguments are positional parameters to a command. They generally2952 provide fewer features than options but can have infinite ``nargs``2953 and are required by default.2954 2950- All parameters are passed onwards to the parameter constructor.2955+ All parameters are passed onwards to the constructor of :class:`Parameter`.2956 """2957 2958 param_type_name = "argument"2959 64 unmodified linesmodified:src/click/decorators.py+12 added
334 unmodified lines335 arguments are forwarded unchanged (except ``cls``).336 This is equivalent to creating an :class:`Argument` instance manually337 and attaching it to the :attr:`Command.params` list.338 339+ For the default argument class, refer to :class:`Argument` and340+ :class:`Parameter` for descriptions of parameters.341+342 :param cls: the argument class to instantiate. This defaults to343 :class:`Argument`.344+ :param param_decls: Passed as positional arguments to the constructor of345+ ``cls``.346+ :param attrs: Passed as keyword arguments to the constructor of ``cls``.347 """348 349 def decorator(f: FC) -> FC:350 ArgumentClass = attrs.pop("cls", None) or Argument9 unmodified lines360 arguments are forwarded unchanged (except ``cls``).361 This is equivalent to creating an :class:`Option` instance manually362 and attaching it to the :attr:`Command.params` list.363 364+ For the default option class, refer to :class:`Option` and365+ :class:`Parameter` for descriptions of parameters.366+367 :param cls: the option class to instantiate. This defaults to368 :class:`Option`.369+ :param param_decls: Passed as positional arguments to the constructor of370+ ``cls``.371+ :param attrs: Passed as keyword arguments to the constructor of ``cls``.372 """373 374 def decorator(f: FC) -> FC:375 # Issue 926, copy attrs, so pre-defined options can re-use the same cls=192 unmodified lines