OpenQuizz
Une application de gestion des contenus pédagogiques
Command Class Reference
Inheritance diagram for Command:
Collaboration diagram for Command:

Public Member Functions

def __init__ (self, name, context_settings=None, callback=None, params=None, help=None, epilog=None, short_help=None, options_metavar="[OPTIONS]", add_help_option=True, no_args_is_help=False, hidden=False, deprecated=False)
 
def get_usage (self, ctx)
 
def get_params (self, ctx)
 
def format_usage (self, ctx, formatter)
 
def collect_usage_pieces (self, ctx)
 
def get_help_option_names (self, ctx)
 
def get_help_option (self, ctx)
 
def make_parser (self, ctx)
 
def get_help (self, ctx)
 
def get_short_help_str (self, limit=45)
 
def format_help (self, ctx, formatter)
 
def format_help_text (self, ctx, formatter)
 
def format_options (self, ctx, formatter)
 
def format_epilog (self, ctx, formatter)
 
def parse_args (self, ctx, args)
 
def invoke (self, ctx)
 
- Public Member Functions inherited from BaseCommand
def __init__ (self, name, context_settings=None)
 
def __repr__ (self)
 
def make_context (self, info_name, args, parent=None, **extra)
 
def main (self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra)
 
def __call__ (self, *args, **kwargs)
 

Data Fields

 callback
 
 params
 
 help
 
 epilog
 
 options_metavar
 
 short_help
 
 add_help_option
 
 no_args_is_help
 
 hidden
 
 deprecated
 
- Data Fields inherited from BaseCommand
 name
 
 context_settings
 

Additional Inherited Members

- Static Public Attributes inherited from BaseCommand
bool allow_extra_args = False
 
bool allow_interspersed_args = True
 
bool ignore_unknown_options = False
 

Detailed Description

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.

.. versionchanged:: 2.0
   Added the `context_settings` parameter.
.. versionchanged:: 7.1
   Added the `no_args_is_help` parameter.

:param name: the name of the command to use unless a group overrides it.
:param context_settings: an optional dictionary with defaults that are
                         passed to the context object.
:param callback: the callback to invoke.  This is optional.
:param params: the parameters to register with this command.  This can
               be either :class:`Option` or :class:`Argument` objects.
:param help: the help string to use for this command.
:param epilog: like the help string but it's printed at the end of the
               help page after everything else.
:param short_help: the short help to use for this command.  This is
                   shown on the command listing of the parent command.
:param add_help_option: by default each command registers a ``--help``
                        option.  This can be disabled by this parameter.
:param no_args_is_help: this controls what happens if no arguments are
                        provided.  This option is disabled by default.
                        If enabled this will add ``--help`` as argument
                        if no arguments are passed
:param hidden: hide this command from help outputs.

:param deprecated: issues a message indicating that
                         the command is deprecated.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  context_settings = None,
  callback = None,
  params = None,
  help = None,
  epilog = None,
  short_help = None,
  options_metavar = "[OPTIONS]",
  add_help_option = True,
  no_args_is_help = False,
  hidden = False,
  deprecated = False 
)

Member Function Documentation

◆ collect_usage_pieces()

def collect_usage_pieces (   self,
  ctx 
)
Returns all the pieces that go into the usage line and returns
it as a list of strings.

Reimplemented in MultiCommand.

◆ format_epilog()

def format_epilog (   self,
  ctx,
  formatter 
)
Writes the epilog into the formatter if it exists.

◆ format_help()

def format_help (   self,
  ctx,
  formatter 
)
Writes the help into the formatter if it exists.

This is a low-level method called by :meth:`get_help`.

This calls the following methods:

-   :meth:`format_usage`
-   :meth:`format_help_text`
-   :meth:`format_options`
-   :meth:`format_epilog`

◆ format_help_text()

def format_help_text (   self,
  ctx,
  formatter 
)
Writes the help text to the formatter if it exists.

◆ format_options()

def format_options (   self,
  ctx,
  formatter 
)
Writes all the options into the formatter if they exist.

Reimplemented in MultiCommand.

◆ format_usage()

def format_usage (   self,
  ctx,
  formatter 
)
Writes the usage line into the formatter.

This is a low-level method called by :meth:`get_usage`.

◆ get_help()

def get_help (   self,
  ctx 
)
Formats the help into a string and returns it.

Calls :meth:`format_help` internally.

Reimplemented from BaseCommand.

◆ get_help_option()

def get_help_option (   self,
  ctx 
)
Returns the help option object.

◆ get_help_option_names()

def get_help_option_names (   self,
  ctx 
)
Returns the names for the help option.

◆ get_params()

def get_params (   self,
  ctx 
)

◆ get_short_help_str()

def get_short_help_str (   self,
  limit = 45 
)
Gets short help for the command or makes it by shortening the
long help string.

◆ get_usage()

def get_usage (   self,
  ctx 
)
Formats the usage line into a string and returns it.

Calls :meth:`format_usage` internally.

Reimplemented from BaseCommand.

◆ invoke()

def invoke (   self,
  ctx 
)
Given a context, this invokes the attached callback (if it exists)
in the right way.

Reimplemented from BaseCommand.

Reimplemented in MultiCommand.

◆ make_parser()

def make_parser (   self,
  ctx 
)
Creates the underlying option parser for this command.

◆ parse_args()

def parse_args (   self,
  ctx,
  args 
)
Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by :meth:`make_context`.

Reimplemented from BaseCommand.

Reimplemented in MultiCommand.

Field Documentation

◆ add_help_option

add_help_option

◆ callback

callback

◆ deprecated

deprecated

◆ epilog

epilog

◆ help

help

◆ hidden

hidden

◆ no_args_is_help

no_args_is_help

◆ options_metavar

options_metavar

◆ params

params

◆ short_help

short_help

The documentation for this class was generated from the following file: