Internals¶
Clik extension for adding an interactive command shell to an application.
| author: | Joe Joyce <joe@decafjoe.com> |
|---|---|
| copyright: | Copyright (c) Joe Joyce and contributors, 2017. |
| license: | BSD |
-
clik_shell.EXCLUDE= <object object>¶ Unique object used to indicate that a command should not be present in the shell.
Type: object
-
clik_shell.get_shell_subcommands_for(parent_command)[source]¶ Return list of command objects that should be present in the shell.
This excludes the commands that have been marked with
exclude_from_shell().Parameters: command ( clik.command.Command) – Command for which to get shell subcommandsReturns: List of commands that should be present in the shell Return type: listofclik.command.Commandinstances
-
clik_shell.parser_for(*args, **kwds)[source]¶ Context manager that creates a root parser object for
command.See
make_action_method()andmake_help_method()for usage.Parameters: command ( clik.command.Command) – Command for which to create a parserReturns: Argument parser for the command Return type: argparse.ArgumentParser
-
clik_shell.make_action_method(command)[source]¶ Dynamically generate the
do_method forcommand.Parameters: command ( clik.command.Command) – Command for which to generatedo_methodReturns: Method that calls the given command Return type: fn(self, line)
-
clik_shell.make_help_method(command)[source]¶ Dynamically generate the
help_method forcommand.Parameters: command ( clik.command.Command) – Command for which to generatehelp_methodReturns: Method that prints the help for the given command Return type: fn(self)