cloudmesh_client.shell package

Subpackages

Submodules

cloudmesh_client.shell.cm module

class cloudmesh_client.shell.cm.CloudmeshConsole(context)[source]

Bases: cmd.Cmd, cloudmesh_client.shell.cm.CommandProxyClass

do_EOF(args)[source]
Usage:
    EOF

Description:
    Command to the shell to terminate reading a script.
do_context(args)[source]
Usage:
    context

Description:
    Lists the context variables and their values
do_exec(filename)[source]
Usage:
   exec FILENAME

executes the commands in the file. See also the script command.

Arguments:
  FILENAME   The name of the file
do_h(instance, args)
Usage:
history history list history last history ID
do_help(arg)[source]
Usage:
    help
    help COMMAND

Description:
    List available commands with "help" or detailed help with
    "help COMMAND".
do_history(instance, args)
Usage:
history history list history last history ID
do_q(args)
Usage:
    quit

Description:
    Action to be performed whne quit is typed
do_quit(args)[source]
Usage:
    quit

Description:
    Action to be performed whne quit is typed
do_shell(instance, args)
Usage:
shell ARGUMENTS…
Description:
Executes a shell command
do_shell_exec(args)[source]
do_var(instance, args)
Usage:
var list var delete NAMES var NAME=VALUE var NAME
Arguments:
NAME Name of the variable NAMES Names of the variable separated by spaces VALUE VALUE to be assigned

special vars date and time are defined

do_version(instance, args)
Usage:
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:
Prints out the version number
emptyline()[source]
help_help()[source]
Usage:
   help NAME

Prints out the help message for a given function
load_instancemethod(location)[source]
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.

postcmd(stop, line)[source]
precmd(line)[source]
preloop()[source]

adds the banner to the preloop

register_command_topic(topic, command_name)[source]
register_topics()[source]
replace_vars(line)[source]
update_time()[source]
var_finder(line, c='$')[source]
var_replacer(line, c='$')[source]
class cloudmesh_client.shell.cm.CloudmeshContext(**kwargs)[source]

Bases: object

cloudmesh_client.shell.cm.PluginCommandClasses

# not yet implemented class ConsoleClasses(object):

def __init__(self, *command_classes):

classes = [] for c in command_classes:

classes.append(PluginCommand.__subclasses__())

print (classes)

PluginCommandClasses = type(
‘CommandProxyClass’, tuple(classes), {})

return PluginCommandClasses

alias of CommandProxyClass

cloudmesh_client.shell.cm.main()[source]
Usage:
cm –help cm [–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]
cloudmesh_client.shell.cm.simple()[source]

cloudmesh_client.shell.cm_shell_status module

class cloudmesh_client.shell.cm_shell_status.cm_shell_status(context)[source]

Bases: cloudmesh_client.shell.command.PluginCommand, cloudmesh_client.shell.command.ShellPluginCommand

do_status(instance, args)
Usage:
    status
    status db
    status CLOUDS...




Arguments:



Options:
topics = {'status': 'cloud'}

cloudmesh_client.shell.command module

class cloudmesh_client.shell.command.CloudPluginCommand[source]

Bases: object

class cloudmesh_client.shell.command.CometPluginCommand[source]

Bases: object

class cloudmesh_client.shell.command.HPCPluginCommand[source]

Bases: object

class cloudmesh_client.shell.command.PluginCommand[source]

Bases: object

class cloudmesh_client.shell.command.ShellPluginCommand[source]

Bases: object

cloudmesh_client.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 “”” pass

will 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_client.shell.console module

class cloudmesh_client.shell.console.Console[source]

Bases: object

A simple way to print in a console terminal in color. Instead of using simply the print statement you can use special methods to indicate warnings, errors, ok and regular messages.

Example Usage:

Console.warning("Warning")
Console.error("Error")
Console.info("Info")
Console.msg("msg")
Console.ok("Success")

One can swith the color mode off with:

Console.color = False
Console.error("Error")

The color will be switched on by default.

static TODO(message, prefix=True, traceflag=True)[source]
color = True
static cprint(color, prefix, message)[source]
debug = True
static debug_msg(message)[source]
classmethod error(message, prefix=True, traceflag=True)[source]
static get(name)[source]
static info(message)[source]
static msg(message)[source]
static ok(message)[source]
classmethod set_debug(on=True)[source]
static set_theme(color=True)[source]
theme = {'OKBLUE': '\x1b[34m', 'OKGREEN': '\x1b[32m', 'BOLD': '\x1b[1m', 'HEADER': '\x1b[35m', 'ENDC': '\x1b[0m', 'BLACK': '\x1b[30m', 'FAIL': '\x1b[31m', 'CYAN': '\x1b[36m', 'WHITE': '\x1b[37m', 'RED': '\x1b[31m', 'BLUE': '\x1b[34m', 'WARNING': '\x1b[35m', 'GREEN': '\x1b[32m'}
theme_bw = {'OKBLUE': '', 'OKGREEN': '', 'BOLD': '', 'HEADER': '', 'ENDC': '', 'BLACK': '', 'FAIL': '', 'CYAN': '', 'WHITE': '', 'RED': '', 'BLUE': '', 'WARNING': '', 'GREEN': ''}
theme_color = {'OKBLUE': '\x1b[34m', 'OKGREEN': '\x1b[32m', 'BOLD': '\x1b[1m', 'HEADER': '\x1b[35m', 'ENDC': '\x1b[0m', 'BLACK': '\x1b[30m', 'FAIL': '\x1b[31m', 'CYAN': '\x1b[36m', 'WHITE': '\x1b[37m', 'RED': '\x1b[31m', 'BLUE': '\x1b[34m', 'WARNING': '\x1b[35m', 'GREEN': '\x1b[32m'}
static warning(message)[source]
cloudmesh_client.shell.console.indent(text, indent=2, width=128)[source]

Module contents