def make_cmd_fn(cmd):
 def do_cmd(rest_of_line, cmd=cmd):
  (global_dict, local_dict) = namespaces.get_twill_glocals()
  args = []
  if (rest_of_line.strip() != ''):
   try:
    args = parse.arguments.parseString(rest_of_line)[0]
    args = parse.process_args(args, global_dict, local_dict)
   except Exception as e:
    print ('\nINPUT ERROR: %s\n' % (str(e),))
    return
  try:
   parse.execute_command(cmd, args, global_dict, local_dict, '<shell>')
  except SystemExit:
   raise
  except Exception as e:
   print ('\nERROR: %s\n' % (str(e),))
 return do_cmd

def make_cmd_fn ( cmd ) : def do_cmd ( rest_of_line , cmd = cmd ) : ( global_dict , local_dict ) = namespaces . get_twill_glocals ( ) args = [ ] if ( rest_of_line . strip ( ) != '' ) : try : args = parse . arguments . parseString ( rest_of_line ) [ 0 ] args = parse . process_args ( args , global_dict , local_dict ) except Exception as e : print ( '\nINPUT ERROR: %s\n' % ( str ( e ) , ) ) return try : parse . execute_command ( cmd , args , global_dict , local_dict , '<shell>' ) except SystemExit : raise except Exception as e : print ( '\nERROR: %s\n' % ( str ( e ) , ) ) return do_cmd
dynamically define a twill shell command function based on an imported function name .