From ae15f04c1957491ab91dd4ba42e0320d7e29fdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Fri, 9 Nov 2018 13:12:18 -0500 Subject: more pythonic args checking --- bin/review-update-needed | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'bin/review-update-needed') diff --git a/bin/review-update-needed b/bin/review-update-needed index ad54dbfdbc..b50bd513cb 100755 --- a/bin/review-update-needed +++ b/bin/review-update-needed @@ -26,6 +26,7 @@ parser.add_argument('--lts', action='store_true', parser.add_argument('-v', '--verbose', action='store_true', help='Show more information, e.g. notes, commit author and per user stats') parser.add_argument('--sort-by', default='last-update', + choices=('last-update', 'claimed-date'), help='Sort by last-update (default) or by claimed-date') parser.add_argument('--skip-unclaimed', action='store_true', help='Skip unclaimed packages in the review') @@ -36,17 +37,11 @@ if args.lts: else: dsa_dla_needed = 'data/dsa-needed.txt' -if args.sort_by not in ('last-update', 'claimed-date'): - sys.stderr.write('ERROR: usage: --sort-by={last-update,claimed-date}\n') - sys.exit(1) - if not os.path.exists(dsa_dla_needed): - sys.stderr.write("ERROR: {} not found\n".format(dsa_dla_needed)) - sys.exit(1) + args.error("ERROR: {} not found\n".format(dsa_dla_needed)) if not os.path.exists(".git"): - sys.stderr.write("ERROR: works only in a git checkout\n") - sys.exit(1) + args.error("ERROR: works only in a git checkout\n") process = subprocess.Popen(["git", "blame", "--line-porcelain", "--", dsa_dla_needed], stdout=subprocess.PIPE) -- cgit v1.2.3