OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, name=None, invoke_without_command=False, no_args_is_help=None, subcommand_metavar=None, chain=False, result_callback=None, **attrs) |
def | collect_usage_pieces (self, ctx) |
def | format_options (self, ctx, formatter) |
def | resultcallback (self, replace=False) |
def | format_commands (self, ctx, formatter) |
def | parse_args (self, ctx, args) |
def | invoke (self, ctx) |
def | resolve_command (self, ctx, args) |
def | get_command (self, ctx, cmd_name) |
def | list_commands (self, ctx) |
![]() | |
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 | 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_epilog (self, ctx, formatter) |
![]() | |
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 | |
no_args_is_help | |
invoke_without_command | |
subcommand_metavar | |
chain | |
result_callback | |
![]() | |
callback | |
params | |
help | |
epilog | |
options_metavar | |
short_help | |
add_help_option | |
no_args_is_help | |
hidden | |
deprecated | |
![]() | |
name | |
context_settings | |
Static Public Attributes | |
bool | allow_extra_args = True |
bool | allow_interspersed_args = False |
![]() | |
bool | allow_extra_args = False |
bool | allow_interspersed_args = True |
bool | ignore_unknown_options = False |
A multi command is the basic implementation of a command that dispatches to subcommands. The most common version is the :class:`Group`. :param invoke_without_command: this controls how the multi command itself is invoked. By default it's only invoked if a subcommand is provided. :param no_args_is_help: this controls what happens if no arguments are provided. This option is enabled by default if `invoke_without_command` is disabled or disabled if it's enabled. If enabled this will add ``--help`` as argument if no arguments are passed. :param subcommand_metavar: the string that is used in the documentation to indicate the subcommand place. :param chain: if this is set to `True` chaining of multiple subcommands is enabled. This restricts the form of commands in that they cannot have optional arguments but it allows multiple commands to be chained together. :param result_callback: the result callback to attach to this multi command.
def __init__ | ( | self, | |
name = None , |
|||
invoke_without_command = False , |
|||
no_args_is_help = None , |
|||
subcommand_metavar = None , |
|||
chain = False , |
|||
result_callback = None , |
|||
** | attrs | ||
) |
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 from Command.
def format_commands | ( | self, | |
ctx, | |||
formatter | |||
) |
Extra format methods for multi methods that adds all the commands after the options.
def format_options | ( | self, | |
ctx, | |||
formatter | |||
) |
Writes all the options into the formatter if they exist.
Reimplemented from Command.
def get_command | ( | self, | |
ctx, | |||
cmd_name | |||
) |
Given a context and a command name, this returns a :class:`Command` object if it exists or returns `None`.
Reimplemented in FlaskGroup, CommandCollection, and Group.
def invoke | ( | self, | |
ctx | |||
) |
Given a context, this invokes the attached callback (if it exists) in the right way.
Reimplemented from Command.
def list_commands | ( | self, | |
ctx | |||
) |
Returns a list of subcommand names in the order they should appear.
Reimplemented in CommandCollection, Group, and FlaskGroup.
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 Command.
def resolve_command | ( | self, | |
ctx, | |||
args | |||
) |
def resultcallback | ( | self, | |
replace = False |
|||
) |
Adds a result callback to the chain command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcommand (or the list of return values from all subcommands if chaining is enabled) as well as the parameters as they would be passed to the main callback. Example:: @click.group() @click.option('-i', '--input', default=23) def cli(input): return 42 @cli.resultcallback() def process_result(result, input): return result + input .. versionadded:: 3.0 :param replace: if set to `True` an already existing result callback will be removed.
|
static |
|
static |
chain |
invoke_without_command |
no_args_is_help |
result_callback |
subcommand_metavar |