def launch_shell(): ''' Add commands for testing, etc.. ''' parser = argparse.ArgumentParser( description='Launch the psiTurk interactive shell.' ) # Optional flags parser.add_argument( '-v', '--version', help='Print version number.', action="store_true" ) parser.add_argument( '-c', '--cabinmode', help='Launch psiturk in cabin (offline) mode', action="store_true" ) parser.add_argument( '-s', '--script', help='Run commands from a script file' ) args = parser.parse_args() # If requested version just print and quite if args.version: print version_number else: import psiturk.psiturk_shell as ps if args.script: ps.run(cabinmode=args.cabinmode, script=args.script) else: ps.run(cabinmode=args.cabinmode)
def launch_shell(): ''' Add commands for testing, etc.. ''' parser = argparse.ArgumentParser( description='Launch the psiTurk interactive shell.') # Optional flags parser.add_argument('-v', '--version', help='Print version number.', action="store_true") parser.add_argument('-c', '--cabinmode', help='Launch psiturk in cabin (offline) mode', action="store_true") parser.add_argument('-s', '--script', help='Run commands from a script file') args = parser.parse_args() # If requested version just print and quite if args.version: print version_number else: import psiturk.psiturk_shell as ps if args.script: ps.run(cabinmode=args.cabinmode, script=args.script) else: ps.run(cabinmode=args.cabinmode)
def test_nonaws_still_can_do(capfd, edit_config_file, experiment_server_controller, psiturk_shell): import os from psiturk.psiturk_shell import run edit_config_file('persistent_history_file = .psiturk_history', 'persistent_history_file = ') edit_config_file('launch_in_sandbox_mode = false', 'launch_in_sandbox_mode = true') os.environ['AWS_ACCESS_KEY_ID'] = '' os.environ['AWS_SECRET_ACCESS_KEY'] = '' run(execute='version', quiet=True) out, err = capfd.readouterr() assert 'version' in out
def launch_shell(): ''' Add commands for testing, etc.. ''' parser = argparse.ArgumentParser( description='Launch the psiTurk interactive shell.' ) # Optional flags parser.add_argument( '-v', '--version', help='Print version number.', action="store_true" ) parser.add_argument( '-c', '--cabinmode', help='Launch psiturk in cabin (offline) mode', action="store_true" ) script_group = parser.add_mutually_exclusive_group() script_group.add_argument( '-s', '--script', help='Run commands from a script file' ) script_group.add_argument( '-e', '--execute', help='Execute one command specified on the command line' ) args = parser.parse_args() # If requested version just print and quite if args.version: print version_number else: import psiturk.psiturk_shell as ps if args.script: ps.run(cabinmode=args.cabinmode, script=args.script, quiet=True) elif args.execute: ps.run(cabinmode=args.cabinmode, execute=args.execute, quiet=True) else: ps.run(cabinmode=args.cabinmode)
def launch_shell(): """Add commands for testing, etc.""" parser = argparse.ArgumentParser( description='Launch the psiTurk interactive shell.') # Optional flags parser.add_argument('-v', '--version', help='Print version number.', action="store_true") script_group = parser.add_mutually_exclusive_group() script_group.add_argument('-s', '--script', help='Run commands from a script file') script_group.add_argument( '-e', '--execute', help='Execute one command specified on the command line') script_group.add_argument('-t', '--test', help='Run cmd2 unittest using provided file') args, unknownargs = parser.parse_known_args() # If requested version just print and quit if args.version: print(version_number) else: import psiturk.psiturk_shell as ps if args.script: ps.run(script=args.script, quiet=True) elif args.test: ps.run(testfile=args.test, quiet=True) elif args.execute or unknownargs: if unknownargs: import shlex execute = ' '.join([shlex.quote(e) for e in unknownargs]) else: execute = args.execute ps.run(execute=execute, quiet=True) else: ps.run()
def do_it(execute_string): ps.run(cabinmode=False, execute=execute_string, quiet=True)