Loading bin/cc-cli +2 −2 Original line number Diff line number Diff line Loading @@ -135,10 +135,10 @@ try: except BadArgument as e: printer.error("Bad Argument: %s"%str(e)) oparser.print_help() except cliError as e: printer.error(str(e)) except KeyboardInterrupt: exit(1) except cliError as e: printer.error(str(e)) except Exception as e: if cccli.debug: printer.fatal(str(e), quit=False) Loading cccli/cli.py +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ from cccli.printer import Printer, color from cccli.exception import * from sjrpc.client import SimpleRpcClient from sjrpc.utils import RpcHandler, ConnectionProxy, pure from sjrpc.utils import RpcHandler, pure from sjrpc.core.exceptions import * class Cli(object): Loading cccli/command.py +16 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import sys import re import pprint import ConfigParser import code from optparse import OptionParser import cccli Loading @@ -17,6 +18,7 @@ from cccli.exception import * from cccli.printer import color from sjrpc.client import SimpleRpcClient from sjrpc.utils import ConnectionProxy from sjrpc.core.exceptions import * class Command(object): Loading Loading @@ -367,6 +369,20 @@ class Command(object): raise cmdError("RPCError: %s"%str(e)) cmd_passwd.usage = "passwd <account> [password]" def cmd_expert(self, argv): '''Switch in expert mode''' self.printer.history.save(self.cli.settings.get("history", "")) try: local = dict() local["cli"] = self.cli local["rpc"] = self.cli.rpc local["proxy"] = ConnectionProxy(self.cli.rpc) c = code.InteractiveConsole(local) c.interact("Use Ctrl+D to go back in CLI") finally: self.printer.history.load(self.cli.settings.get("history", "")) cmd_expert.usage = "expert" class Alias(dict): ''' Alias wrapper''' Loading cccli/printer.py +2 −2 Original line number Diff line number Diff line Loading @@ -106,8 +106,8 @@ class Printer(object): raise except KeyboardInterrupt: raise except: raise cliError except Exception as e: raise cliError(str(e)) if not history and s: self.history.removelast() return s Loading Loading
bin/cc-cli +2 −2 Original line number Diff line number Diff line Loading @@ -135,10 +135,10 @@ try: except BadArgument as e: printer.error("Bad Argument: %s"%str(e)) oparser.print_help() except cliError as e: printer.error(str(e)) except KeyboardInterrupt: exit(1) except cliError as e: printer.error(str(e)) except Exception as e: if cccli.debug: printer.fatal(str(e), quit=False) Loading
cccli/cli.py +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ from cccli.printer import Printer, color from cccli.exception import * from sjrpc.client import SimpleRpcClient from sjrpc.utils import RpcHandler, ConnectionProxy, pure from sjrpc.utils import RpcHandler, pure from sjrpc.core.exceptions import * class Cli(object): Loading
cccli/command.py +16 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import sys import re import pprint import ConfigParser import code from optparse import OptionParser import cccli Loading @@ -17,6 +18,7 @@ from cccli.exception import * from cccli.printer import color from sjrpc.client import SimpleRpcClient from sjrpc.utils import ConnectionProxy from sjrpc.core.exceptions import * class Command(object): Loading Loading @@ -367,6 +369,20 @@ class Command(object): raise cmdError("RPCError: %s"%str(e)) cmd_passwd.usage = "passwd <account> [password]" def cmd_expert(self, argv): '''Switch in expert mode''' self.printer.history.save(self.cli.settings.get("history", "")) try: local = dict() local["cli"] = self.cli local["rpc"] = self.cli.rpc local["proxy"] = ConnectionProxy(self.cli.rpc) c = code.InteractiveConsole(local) c.interact("Use Ctrl+D to go back in CLI") finally: self.printer.history.load(self.cli.settings.get("history", "")) cmd_expert.usage = "expert" class Alias(dict): ''' Alias wrapper''' Loading
cccli/printer.py +2 −2 Original line number Diff line number Diff line Loading @@ -106,8 +106,8 @@ class Printer(object): raise except KeyboardInterrupt: raise except: raise cliError except Exception as e: raise cliError(str(e)) if not history and s: self.history.removelast() return s Loading