def main(): print("Running the configurator") # required for travis tests if len(sys.argv) > 2 and sys.argv[-2] == 'scripts/configurator_tests/': sys.argv = [sys.argv[:-2]] args = parsers._config_arg_parser() if args.error: utils.error_level = 1 print("Starting Savu Config tool (please wait for prompt)") _reduce_logging_level() content = Content(level="all" if args.disp_all else 'user') with warnings.catch_warnings(): warnings.simplefilter("ignore") content.failed = utils.populate_plugins(error_mode=args.error, examples=args.examples) comp = Completer(commands=commands, plugin_list=pu.plugins) utils._set_readline(comp.complete) # if file flag is passed then open it here if args.file: commands['open'](content, args.file) print("\n*** Press Enter for a list of available commands. ***\n") utils.load_history_file(utils.histfile) while True: try: in_list = raw_input(">>> ").strip().split(' ', 1) except KeyboardInterrupt: print() continue command, arg = in_list if len(in_list) == 2 else in_list + [''] command = command if command else 'help' if command not in commands: print("I'm sorry, that's not a command I recognise. Press Enter " "for a list of available commands.") else: content = commands[command](content, arg) if content.is_finished(): break print("Thanks for using the application")
def main(): # required for travis tests if len(sys.argv) > 2 and sys.argv[-2] == 'scripts/configurator_tests/': sys.argv = [sys.argv[:-2]] args = parsers._config_arg_parser() if args.error: utils.error_level = 1 print("Starting Savu Config tool (please wait for prompt)") utils.populate_plugins() comp = Completer(commands=commands, plugin_list=pu.plugins) utils._set_readline(comp.complete) content = Content(level="all" if args.disp_all else 'user') # if file flag is passed then open it here if args.file: commands['open'](content, args.file) print("\n*** Press Enter for a list of available commands. ***\n") while True: try: in_list = raw_input(">>> ").strip().split(' ', 1) except KeyboardInterrupt: print() continue command, arg = in_list if len(in_list) is 2 else in_list+[''] command = command if command else 'help' if command not in commands: print("I'm sorry, that's not a command I recognise. Press Enter " "for a list of available commands.") else: content = commands[command](content, arg) if content.is_finished(): break # write the history to the history file utils.readline.write_history_file(utils.histfile) print("Thanks for using the application")
def main(): # required for travis tests if len(sys.argv) > 2 and sys.argv[-2] == 'scripts/configurator_tests/': sys.argv = [sys.argv[:-2]] args = parsers._config_arg_parser() if args.error: utils.error_level = 1 print("Starting Savu Config tool (please wait for prompt)") utils.populate_plugins() comp = Completer(commands=commands, plugin_list=pu.plugins) utils._set_readline(comp.complete) content = Content(level="all" if args.disp_all else 'user') # if file flag is passed then open it here if args.file: commands['open'](content, args.file) print("\n*** Press Enter for a list of available commands. ***\n") while True: in_list = raw_input(">>> ").strip().split(' ', 1) command, arg = in_list if len(in_list) is 2 else in_list + [''] command = command if command else 'help' if command not in commands: print("I'm sorry, that's not a command I recognise. Press Enter " "for a list of available commands.") else: content = commands[command](content, arg) if content.is_finished(): break # write the history to the history file utils.readline.write_history_file(utils.histfile) print("Thanks for using the application")