1from cpython.__main__ import main, configure_logger 2 3 4def parse_args(): 5 import argparse 6 from c_common.scriptutil import ( 7 add_verbosity_cli, 8 add_traceback_cli, 9 process_args_by_key, 10 ) 11 from cpython.__main__ import _cli_check 12 parser = argparse.ArgumentParser() 13 processors = [ 14 add_verbosity_cli(parser), 15 add_traceback_cli(parser), 16 _cli_check(parser, checks='<globals>'), 17 ] 18 19 args = parser.parse_args() 20 ns = vars(args) 21 22 cmd = 'check' 23 verbosity, traceback_cm = process_args_by_key( 24 args, 25 argv, 26 processors, 27 ['verbosity', 'traceback_cm'], 28 ) 29 30 return cmd, ns, verbosity, traceback_cm 31 32 33(cmd, cmd_kwargs, verbosity, traceback_cm) = parse_args() 34configure_logger(verbosity) 35with traceback_cm: 36 main(cmd, cmd_kwargs) 37