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.
This commit is contained in:
Matthieu Gautier 2017-04-08 17:54:16 +02:00
parent 82625ed62e
commit e816979d51
1 changed files with 2 additions and 1 deletions

View File

@ -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)