MCPcopy
hub / github.com/pallets/click / Command

Class Command

src/click/core.py:956–1569  ·  view source on GitHub ↗

Commands are the basic building block of command line interfaces in Click. A basic command handles command line parsing and might dispatch more parsing to commands nested below it. :param name: the name of the command to use unless a group overrides it. :param context_settings: an

Source from the content-addressed store, hash-verified

954
955
956class Command:
957 """Commands are the basic building block of command line interfaces in
958 Click. A basic command handles command line parsing and might dispatch
959 more parsing to commands nested below it.
960
961 :param name: the name of the command to use unless a group overrides it.
962 :param context_settings: an optional dictionary with defaults that are
963 passed to the context object.
964 :param callback: the callback to invoke. This is optional.
965 :param params: the parameters to register with this command. This can
966 be either :class:`Option` or :class:`Argument` objects.
967 :param help: the help string to use for this command.
968 :param epilog: like the help string but it's printed at the end of the
969 help page after everything else.
970 :param short_help: the short help to use for this command. This is
971 shown on the command listing of the parent command.
972 :param add_help_option: by default each command registers a ``--help``
973 option. This can be disabled by this parameter.
974 :param no_args_is_help: this controls what happens if no arguments are
975 provided. This option is disabled by default.
976 If enabled this will add ``--help`` as argument
977 if no arguments are passed
978 :param hidden: hide this command from help outputs.
979 :param deprecated: If ``True`` or non-empty string, issues a message
980 indicating that the command is deprecated and highlights
981 its deprecation in --help. The message can be customized
982 by using a string as the value.
983
984 .. versionchanged:: 8.2
985 This is the base class for all commands, not ``BaseCommand``.
986 ``deprecated`` can be set to a string as well to customize the
987 deprecation message.
988
989 .. versionchanged:: 8.1
990 ``help``, ``epilog``, and ``short_help`` are stored unprocessed,
991 all formatting is done when outputting help text, not at init,
992 and is done even if not using the ``@command`` decorator.
993
994 .. versionchanged:: 8.0
995 Added a ``repr`` showing the command name.
996
997 .. versionchanged:: 7.1
998 Added the ``no_args_is_help`` parameter.
999
1000 .. versionchanged:: 2.0
1001 Added the ``context_settings`` parameter.
1002 """
1003
1004 #: The context class to create with :meth:`make_context`.
1005 #:
1006 #: .. versionadded:: 8.0
1007 context_class: type[Context] = Context
1008
1009 #: the default for the :attr:`Context.allow_extra_args` flag.
1010 allow_extra_args = False
1011
1012 #: the default for the :attr:`Context.allow_interspersed_args` flag.
1013 allow_interspersed_args = True

Callers 15

test_commandFunction · 0.90
test_groupFunction · 0.90
test_nested_groupFunction · 0.90
test_chainedFunction · 0.90
test_help_optionFunction · 0.90
test_argument_orderFunction · 0.90
test_argument_defaultFunction · 0.90
test_type_choiceFunction · 0.90
test_option_countFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_commandFunction · 0.72
test_groupFunction · 0.72
test_nested_groupFunction · 0.72
test_chainedFunction · 0.72
test_help_optionFunction · 0.72
test_argument_orderFunction · 0.72
test_argument_defaultFunction · 0.72
test_type_choiceFunction · 0.72
test_option_countFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…