From e816979d5119ecf082fa5c96f745ddc03c191661 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Sat, 8 Apr 2017 17:54:16 +0200 Subject: [PATCH] Limit the choice of the targets argument to target we know about. By limiting the choices in the argument parser, we catch argument error at parsing and we can provide useful output (the names of dependencies we can handle) to user in the help or in the error message. --- kiwix-build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kiwix-build.py b/kiwix-build.py index 6bac18a..5c87a29 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -780,7 +780,8 @@ class Builder: def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument('targets', default='kiwix-tools', nargs='?') + parser.add_argument('targets', default='kiwix-tools', nargs='?', + choices=Dependency.all_deps.keys()) parser.add_argument('--working-dir', default=".") parser.add_argument('--libprefix', default=None) parser.add_argument('--target-platform', default="native_dyn", choices=BuildEnv.target_platforms)