3. CMD5¶
-
cloudmesh.shell.command.
basecommand
(func)[source]¶ A decorator to create a function with docopt arguments. It also generates a help function
@command def do_myfunc(self, args):
“”” docopts text “”” passwill create
- def do_myfunc(self, args, arguments):
- “”” docopts text “”” …
- def help_myfunc(self, args, arguments):
- … prints the docopt text …
Parameters: func – the function for the decorator
-
cloudmesh.shell.command.
command
(func)[source]¶ A decorator to create a function with docopt arguments. It also generates a help function
@command def do_myfunc(self, args):
“”” docopts text “”” passwill create
- def do_myfunc(self, args, arguments):
- “”” docopts text “”” …
- def help_myfunc(self, args, arguments):
- … prints the docopt text …
Parameters: func – the function for the decorator
-
cloudmesh.shell.command.
map_parameters
(arguments, *args)[source]¶ This command is useful to map parameters with – to regular argument dicts for easier processing.
Parameters: - arguments –
- args –
Returns: an example is
- map_parameters(arguments,
- ‘active’, ‘cloud’)
where –active=ACTIVE is mapped to arguments[“active”] and –cloud=CLOUD is mapped to arguments[“cloud”]
as arguments is a dotdict, they can than for example be called as
arguments.cloud
-
class
cloudmesh.shell.shell.
CMShell
(completekey='tab', stdin=None, stdout=None)[source]¶ The command shell that inherits all commands from PluginCommand
-
do_help
(arg)[source]¶ Usage: help help COMMAND Description: List available commands with "help" or detailed help with "help COMMAND".
-
do_info
(args)¶ Usage: info [path|commands|files|cloudmesh] Description: info provides internal info about the shell and its packages
-
do_plugin
(args)¶ Usage: plugin install PLUGIN [-s] plugin uninstall PLUGIN plugin list plugin ? [--format=FORMAT] Arguments: PLUGIN the name of the plugin Description: plugin available lists the available plugins plugin list lists the plugin plugin install installs the given plugin plugin uninstall uninstalls the given plugin
-
do_q
(args)¶ Usage: quit Description: Action to be performed when quit is typed
-
do_shell
(args)¶ Usage: shell COMMAND Arguments: COMMAND the command to be executed Description: shell COMMAND executes the command
-
do_version
(args)¶ Usage: version pip [PACKAGE] version [--format=FORMAT] [--check=CHECK] Options: --format=FORMAT the format to print the versions in [default: table] --check=CHECK boolean tp conduct an additional check [default: True] Description: version Prints out the version number version pip Prints the contents of pip list Limitations: Package names must not have a . in them instead you need to use - Thus to query for cloudmesh-cmd5 use cms version pip cloudmesh-cmd5
-
emptyline
()[source]¶ Called when an empty line is entered in response to the prompt.
If this method is not overridden, it repeats the last nonempty command entered.
-
help_help
()[source]¶ Usage: help help COMMAND Description: List available commands with "help" or detailed help with "help COMMAND".
-
onecmd
(line)[source]¶ Interpret the argument as though it had been typed in response to the prompt.
This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop.
-
-
class
cloudmesh.shell.shell.
Plugin
[source]¶ Some simple methods to manage dynamic namespace plugins for cloudmesh.
-
classmethod
class_name
(command)[source]¶ creates the default filename in which the module is defined :param command: the name of the command :return: cloudmesh.ext.command.<command>+command.<Command>
-
classmethod
classes
()[source]¶ list of the commands in the cloudmesh namespace under cloudmesh.ext.command :return: list of the commands
-
classmethod
load
(commands=None)[source]¶ Parameters: commands – If None the commands will be found from import cloudmesh Otherwise the commands can be explicitly specified with
- commands = [
- ‘cloudmesh.ext.command.bar.BarCommand’, ‘cloudmesh.ext.command.foo.FooCommand’, ]
A namespace package must exists. Foo and Bar ar just examples
Returns: the classes of the command
-
classmethod
-
cloudmesh.shell.shell.
PluginCommandClasses
¶ alias of
cloudmesh.shell.shell.CommandProxyClass
-
cloudmesh.shell.shell.
main
()[source]¶ cms.
- Usage:
- cms –help cms [–echo] [–debug] [–nosplash] [-i] [COMMAND …]
- Arguments:
- COMMAND A command to be executed
- Options:
--file=SCRIPT -f SCRIPT Executes the script -i After start keep the shell interactive, otherwise quit [default: False] --nosplash do not show the banner [default: False]