2020-10-22 21:42:51 -03:00
|
|
|
from cpython.__main__ import main, configure_logger
|
2017-09-08 02:51:28 -03:00
|
|
|
|
|
|
|
|
2020-10-22 21:42:51 -03:00
|
|
|
def parse_args():
|
2017-09-08 02:51:28 -03:00
|
|
|
import argparse
|
2020-10-22 21:42:51 -03:00
|
|
|
from c_common.scriptutil import (
|
|
|
|
add_verbosity_cli,
|
|
|
|
add_traceback_cli,
|
|
|
|
process_args_by_key,
|
|
|
|
)
|
|
|
|
from cpython.__main__ import _cli_check
|
2017-09-08 02:51:28 -03:00
|
|
|
parser = argparse.ArgumentParser()
|
2020-10-22 21:42:51 -03:00
|
|
|
processors = [
|
|
|
|
add_verbosity_cli(parser),
|
|
|
|
add_traceback_cli(parser),
|
|
|
|
_cli_check(parser, checks='<globals>'),
|
|
|
|
]
|
2017-09-08 02:51:28 -03:00
|
|
|
|
2020-10-22 21:42:51 -03:00
|
|
|
args = parser.parse_args()
|
|
|
|
ns = vars(args)
|
2017-09-08 02:51:28 -03:00
|
|
|
|
2020-10-22 21:42:51 -03:00
|
|
|
cmd = 'check'
|
|
|
|
verbosity, traceback_cm = process_args_by_key(
|
|
|
|
args,
|
|
|
|
processors,
|
|
|
|
['verbosity', 'traceback_cm'],
|
|
|
|
)
|
2017-09-08 02:51:28 -03:00
|
|
|
|
2020-10-22 21:42:51 -03:00
|
|
|
return cmd, ns, verbosity, traceback_cm
|
2017-09-08 02:51:28 -03:00
|
|
|
|
|
|
|
|
2020-10-22 21:42:51 -03:00
|
|
|
(cmd, cmd_kwargs, verbosity, traceback_cm) = parse_args()
|
|
|
|
configure_logger(verbosity)
|
|
|
|
with traceback_cm:
|
|
|
|
main(cmd, cmd_kwargs)
|