diff options
author | Antoine Beaupré <anarcat@debian.org> | 2018-11-09 13:12:18 -0500 |
---|---|---|
committer | Antoine Beaupré <anarcat@debian.org> | 2018-11-09 13:12:18 -0500 |
commit | ae15f04c1957491ab91dd4ba42e0320d7e29fdeb (patch) | |
tree | 42754e63130ee0b60bd86dcdcbcce7ba35fe79e2 /bin/review-update-needed | |
parent | ae09096013e6aca054df520f64962bc60c287c52 (diff) |
more pythonic args checking
Diffstat (limited to 'bin/review-update-needed')
-rwxr-xr-x | bin/review-update-needed | 11 |
1 files changed, 3 insertions, 8 deletions
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) |