refactor: Move `check-templates` argument parsing to top level.

This commit is contained in:
Elliott Jin 2017-03-19 12:59:22 -07:00 committed by Tim Abbott
parent 0d677042e7
commit 357e1a001f
1 changed files with 11 additions and 12 deletions

View File

@ -22,17 +22,8 @@ EXCLUDED_FILES = [
"tools/tests/test_template_data", "tools/tests/test_template_data",
] ]
def check_our_files(): def check_our_files(modified_only, all_dups):
# type: () -> None # type: (bool, bool) -> None
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--modified',
action='store_true', default=False,
help='only check modified files')
parser.add_argument('--all-dups',
action="store_true", default=False,
help='Run lint tool to detect duplicate ids on ignored files as well')
args = parser.parse_args()
by_lang = cast( by_lang = cast(
Dict[str, List[str]], Dict[str, List[str]],
lister.list_files( lister.list_files(
@ -245,4 +236,12 @@ def check_handlebar_templates(templates):
sys.exit(1) sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
check_our_files() parser = argparse.ArgumentParser()
parser.add_argument('-m', '--modified',
action='store_true', default=False,
help='only check modified files')
parser.add_argument('--all-dups',
action="store_true", default=False,
help='Run lint tool to detect duplicate ids on ignored files as well')
args = parser.parse_args()
check_our_files(args.modified, args.all_dups)