def main(args: Optional[List[str]] = None) -> None: log.addHandler(log.logging.StreamHandler(sys.stderr)) log.setLevel(log.logging.INFO) is_updated = update_checking.run() parser = get_parser() namespace = parser.parse_args(args=args) try: run_program(namespace, parser=parser) except NotImplementedError as e: log.debug('\n' + traceback.format_exc()) log.error('NotImplementedError') log.info( 'The operation you specified is not supported yet. Pull requests are welcome.' ) log.info( 'see: https://github.com/kmyk/online-judge-tools/blob/master/CONTRIBUTING.md' ) if not is_updated: log.info('hint: try updating the version of online-judge-tools') sys.exit(1) except Exception as e: log.debug('\n' + traceback.format_exc()) log.error(str(e)) if not is_updated: log.info('hint: try updating the version of online-judge-tools') sys.exit(1)
def main(args: Optional[List[str]] = None) -> None: parser = get_parser() parsed = parser.parse_args(args=args) # configure the logger level = INFO if parsed.verbose: level = DEBUG handler = StreamHandler(sys.stdout) handler.setFormatter(log_formatter.LogFormatter()) basicConfig(level=level, handlers=[handler]) # check update is_updated = update_checking.run() try: run_program(parsed, parser=parser) except NotImplementedError as e: logger.debug('\n' + traceback.format_exc()) logger.error('NotImplementedError') logger.info('The operation you specified is not supported yet. Pull requests are welcome.') logger.info('see: https://github.com/online-judge-tools/oj') if not is_updated: logger.info('hint: try updating the version of online-judge-tools') sys.exit(1) except Exception as e: logger.debug('\n' + traceback.format_exc()) logger.exception(str(e)) if not is_updated: logger.info('hint: try updating the version of online-judge-tools') sys.exit(1)