Exemplo n.º 1
0
 def run(self):
     """loop on user input, exit on EOF"""
     while 1:
         try:
             line = raw_input('>>> ')
         except EOFError:
             print
             break
         s_line = line.strip()
         if not s_line:
             continue
         args = s_line.split()
         if args[0] in self.commands:
             try:
                 cmd = 'do_%s' % self.commands[args[0]]
                 getattr(self, cmd)(*args[1:])
             except EOFError:
                 break
             except:
                 import traceback
                 traceback.print_exc()
         else:
             try:
                 self.handle_line(s_line)
             except:
                 import traceback
                 traceback.print_exc()
Exemplo n.º 2
0
 def run(self):
     """loop on user input, exit on EOF"""
     while True:
         try:
             line = raw_input('>>> ')
         except EOFError:
             print
             break
         s_line = line.strip()
         if not s_line:
             continue
         args = s_line.split()
         if args[0] in self.commands:
             try:
                 cmd = 'do_%s' % self.commands[args[0]]
                 getattr(self, cmd)(*args[1:])
             except EOFError:
                 break
             except:
                 import traceback
                 traceback.print_exc()
         else:
             try:
                 self.handle_line(s_line)
             except:
                 import traceback
                 traceback.print_exc()
Exemplo n.º 3
0
 def input_validator(optdict, question):
     while True:
         value = raw_input(question)
         if not value.strip():
             return None
         try:
             return _call_validator(opttype, optdict, None, value)
         except optparse.OptionValueError, ex:
             msg = str(ex).split(':', 1)[-1].strip()
             print 'bad value: %s' % msg
Exemplo n.º 4
0
 def input_validator(optdict, question):
     while True:
         value = raw_input(question)
         if not value.strip():
             return None
         try:
             return _call_validator(opttype, optdict, None, value)
         except optik_ext.OptionValueError, ex:
             msg = str(ex).split(':', 1)[-1].strip()
             print 'bad value: %s' % msg
Exemplo n.º 5
0
def input_string(optdict, question):
    value = raw_input(question).strip()
    return value or None
Exemplo n.º 6
0
def input_string(optdict, question):
    value = raw_input(question).strip()
    return value or None