fix debugging

This commit is contained in:
Wolfgang Hottgenroth
2007-11-16 09:19:26 +01:00
parent c9e6c2f6b0
commit b370beb829
8 changed files with 63 additions and 36 deletions

View File

@ -22,9 +22,6 @@ class MyCmd(cmd.Cmd):
self.intro = "Hello at the yadyn cli\n"
self.prompt = "yadyn> "
def do_hello(self, l):
self.stdout.write("DO: %s\n" % l)
def do_list(self, l):
try:
parts = l.split(' ')
@ -89,6 +86,20 @@ class MyCmd(cmd.Cmd):
except LocalMyCmdException, e:
self.stdout.write("Failure: %s\n" % str(e.msg))
def do_debug(self, l):
try:
parts = l.split(' ')
if len(parts) != 1:
raise LocalMyCmdException("illegal number of arguments")
if parts[0] == 'on':
Logger.debugEnable()
elif parts[0] == 'off':
Logger.debugDisable()
else:
raise LocalMyCmdException("illegal argument")
except LocalMyCmdException, e:
self.stdout.write("Failure: %s\n" % str(e.msg))
def do_quit(self, l):
self.stdout.write("Bye\n")