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 subcommands
Returns:List of commands that should be present in the shell
Return type:list of clik.command.Command instances
clik_shell.parser_for(*args, **kwds)[source]

Context manager that creates a root parser object for command.

See make_action_method() and make_help_method() for usage.

Parameters:command (clik.command.Command) – Command for which to create a parser
Returns:Argument parser for the command
Return type:argparse.ArgumentParser
clik_shell.make_action_method(command)[source]

Dynamically generate the do_ method for command.

Parameters:command (clik.command.Command) – Command for which to generate do_ method
Returns:Method that calls the given command
Return type:fn(self, line)
clik_shell.make_help_method(command)[source]

Dynamically generate the help_ method for command.

Parameters:command (clik.command.Command) – Command for which to generate help_ method
Returns:Method that prints the help for the given command
Return type:fn(self)