Example #1
0
 def wrapper(*args):
     # print args
     try:
         r = f(*args)
         if r:
             printer.output("DONE: ", printer.OK)
     except Exception, e:
         traceback.print_exc(file = sys.stdout)
         printer.output(e, printer.ERROR)
Example #2
0
    """Executes the command from the script file.

    The script content can be a set of commands that are runnable from the 
    shell. the content comes from a file which contains those command set.

    Args:
        script_content: the script info
    """
    for input in [ln for ln in script_content.split('\n') if ln]:
        cmd, args = get_cmd_args(input)
        cmd_dict[cmd].__call__(*args)



# print welcome header
printer.output("****************************************", printer.OK)
printer.output("Welcome to the shell", printer.OK)
printer.output("****************************************", printer.OK)

# command capture
while True:
    input = raw_input('$ ')
    cmd, args = get_cmd_args(input)
    if cmd == 'q':
        break
    if cmd == '@': # execute batch file.
        collection = []
        for p5script in args:
            with open(p5script, 'r') as f:
                exc_batch(f.read())
    elif cmd_dict.has_key(cmd):