def main(argv=None): """Provide the main entry point.""" message_handler.init(message_handler.NORMAL) if argv is None: argv = sys.argv # process try: env.ensure_charmcraft_environment_is_supported() setup_parts() dispatcher = Dispatcher(argv[1:], COMMAND_GROUPS) retcode = dispatcher.run() except CommandError as err: message_handler.ended_cmderror(err) retcode = err.retcode except KeyboardInterrupt: message_handler.ended_interrupt() retcode = 1 except Exception as err: message_handler.ended_crash(err) retcode = 1 else: message_handler.ended_ok() if retcode is None: retcode = 0 return retcode
def main(argv=None): """Provide the main entry point.""" message_handler.init(message_handler.NORMAL) if argv is None: argv = sys.argv # process try: dispatcher = Dispatcher(argv[1:], COMMAND_GROUPS) dispatcher.run() except CommandError as err: message_handler.ended_cmderror(err) retcode = err.retcode except KeyboardInterrupt: message_handler.ended_interrupt() retcode = 1 except Exception as err: message_handler.ended_crash(err) retcode = 1 else: message_handler.ended_ok() retcode = 0 return retcode
def main(argv=sys.argv): """Main entry point.""" # Setup logging, using DEBUG envvar in case dev wants to show info before # command parsing. mode = message_handler.VERBOSE if 'DEBUG' in os.environ else message_handler.NORMAL message_handler.init(mode) # process try: dispatcher = Dispatcher(argv[1:], COMMAND_GROUPS) dispatcher.run() except CommandError as err: message_handler.ended_cmderror(err) retcode = err.retcode except KeyboardInterrupt: message_handler.ended_interrupt() retcode = 1 except Exception as err: message_handler.ended_crash(err) retcode = 1 else: message_handler.ended_ok() retcode = 0 return retcode