Loading cccli/command/account.py +6 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ class Command_addaccount(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: addaccount <account name> <role>" return "Usage: addaccount <account name> <role>" class Command_delaccount(Command): '''Delete an account''' Loading @@ -36,7 +37,7 @@ class Command_delaccount(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: delaccount <tql>" return "Usage: delaccount <tql>" class Command_close(Command): Loading @@ -51,7 +52,7 @@ class Command_close(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: close <tql>" return "Usage: close <tql>" class Command_declose(Command): Loading @@ -67,7 +68,7 @@ class Command_declose(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: declose <tql>" return "Usage: declose <tql>" class Command_passwd(Command): Loading Loading @@ -95,4 +96,4 @@ class Command_passwd(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: passwd [tql] [password]" return "Usage: passwd [tql] [password]" cccli/command/alias.py +5 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ from cccli.command.command import Command class Command_alias(Command): '''Show or create alias''' def __call__(self, argv): if len(argv) == 1: for n, v in self.cli.alias.items(): Loading @@ -25,10 +26,12 @@ class Command_alias(Command): raise cmdBadArgument() def usage(self): return "usage: alias [name] [value]" return "Usage: alias [name] [value]" class Command_unalias(Command): '''Remove an alias''' def __call__(self, argv): if len(argv) != 2: raise cmdBadArgument() Loading @@ -38,4 +41,4 @@ class Command_unalias(Command): self.cli.alias.save(self.cli.settings.get("alias", "")) def usage(self): return "usage: unalias [name]" return "Usage: unalias [name]" cccli/command/command.py +18 −2 Original line number Diff line number Diff line Loading @@ -5,14 +5,30 @@ CloudControl CLI command module ''' from optparse import OptionParser class Command(object): def __init__(self, cli): def __init__(self, cli, argv0): self.cli = cli self.printer = self.cli.printer self.name = argv0 def usage(self): return "Usage: %s"%self.name def help(self): return self.__doc__ class OptionCommand(Command): def __init__(self, cli, argv0): Command.__init__(self, cli, argv0) self.option = OptionParser(prog=argv0) def usage(self): return None return self.option.format_help().strip() def help(self): return self.__doc__ cccli/command/connection.py +2 −5 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ class Command_uptime(Command): self.printer.out("%s: %ss"%(o["a"], o["con"])) def usage(self): return "usage: uptime [tql]" return "Usage: uptime [tql]" class Command_remote(Command): '''Show remote command list''' Loading @@ -38,8 +39,6 @@ class Command_remote(Command): except RpcError as e: raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: remote" class Command_whoami(Command): '''Show connection login''' Loading @@ -47,8 +46,6 @@ class Command_whoami(Command): def __call__(self, argv): self.printer.out(self.cli.settings["login"]) def usage(self): return "usage: whoami" class Command_kill(Command): '''Kill a server connection''' Loading cccli/command/host.py +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ class Command_exec(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: exec <tql> <command>" return "Usage: exec <tql> <command>" class Command_shutdown(Command): '''Shutdown a physical host''' Loading @@ -32,4 +32,4 @@ class Command_shutdown(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: shutdown <tql>" return "Usage: shutdown <tql>" Loading
cccli/command/account.py +6 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ class Command_addaccount(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: addaccount <account name> <role>" return "Usage: addaccount <account name> <role>" class Command_delaccount(Command): '''Delete an account''' Loading @@ -36,7 +37,7 @@ class Command_delaccount(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: delaccount <tql>" return "Usage: delaccount <tql>" class Command_close(Command): Loading @@ -51,7 +52,7 @@ class Command_close(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: close <tql>" return "Usage: close <tql>" class Command_declose(Command): Loading @@ -67,7 +68,7 @@ class Command_declose(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: declose <tql>" return "Usage: declose <tql>" class Command_passwd(Command): Loading Loading @@ -95,4 +96,4 @@ class Command_passwd(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: passwd [tql] [password]" return "Usage: passwd [tql] [password]"
cccli/command/alias.py +5 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ from cccli.command.command import Command class Command_alias(Command): '''Show or create alias''' def __call__(self, argv): if len(argv) == 1: for n, v in self.cli.alias.items(): Loading @@ -25,10 +26,12 @@ class Command_alias(Command): raise cmdBadArgument() def usage(self): return "usage: alias [name] [value]" return "Usage: alias [name] [value]" class Command_unalias(Command): '''Remove an alias''' def __call__(self, argv): if len(argv) != 2: raise cmdBadArgument() Loading @@ -38,4 +41,4 @@ class Command_unalias(Command): self.cli.alias.save(self.cli.settings.get("alias", "")) def usage(self): return "usage: unalias [name]" return "Usage: unalias [name]"
cccli/command/command.py +18 −2 Original line number Diff line number Diff line Loading @@ -5,14 +5,30 @@ CloudControl CLI command module ''' from optparse import OptionParser class Command(object): def __init__(self, cli): def __init__(self, cli, argv0): self.cli = cli self.printer = self.cli.printer self.name = argv0 def usage(self): return "Usage: %s"%self.name def help(self): return self.__doc__ class OptionCommand(Command): def __init__(self, cli, argv0): Command.__init__(self, cli, argv0) self.option = OptionParser(prog=argv0) def usage(self): return None return self.option.format_help().strip() def help(self): return self.__doc__
cccli/command/connection.py +2 −5 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ class Command_uptime(Command): self.printer.out("%s: %ss"%(o["a"], o["con"])) def usage(self): return "usage: uptime [tql]" return "Usage: uptime [tql]" class Command_remote(Command): '''Show remote command list''' Loading @@ -38,8 +39,6 @@ class Command_remote(Command): except RpcError as e: raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: remote" class Command_whoami(Command): '''Show connection login''' Loading @@ -47,8 +46,6 @@ class Command_whoami(Command): def __call__(self, argv): self.printer.out(self.cli.settings["login"]) def usage(self): return "usage: whoami" class Command_kill(Command): '''Kill a server connection''' Loading
cccli/command/host.py +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ class Command_exec(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: exec <tql> <command>" return "Usage: exec <tql> <command>" class Command_shutdown(Command): '''Shutdown a physical host''' Loading @@ -32,4 +32,4 @@ class Command_shutdown(Command): raise cmdError("RPCError: %s"%str(e)) def usage(self): return "usage: shutdown <tql>" return "Usage: shutdown <tql>"