diff options
author | Thomas Chetwin <tchetwin@bloomberg.net> | 2017-08-16 10:38:03 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2017-08-16 17:14:44 +0200 |
commit | 52807a865840d776171eaab795e4220bb99bd3e4 (patch) | |
tree | 7ed0dc3609a212a05681507601ec6f9d894c3f0e | |
parent | 520cde8d2f3ab7748f6e292186b7b4d7f072dcea (diff) | |
download | buildstream-52807a865840d776171eaab795e4220bb99bd3e4.tar.gz |
_frontend/main.py: Use click.INT type for bst workspace --source
`bst workspace {open,close,reset} <bst> --source <index>` commands currently
give an indexing error. The python click library needs to be told that the
expected argument is of type integer.
This patch also makes use of metavar to display a placeholder in the help
prompt, like:
-s, --source INDEX The source to create a workspace for. Projects with one
source may omit this
-rw-r--r-- | buildstream/_frontend/main.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py index 0ec1c5495..d5dd33ff2 100644 --- a/buildstream/_frontend/main.py +++ b/buildstream/_frontend/main.py @@ -489,7 +489,7 @@ def workspace(): help="Do not checkout the source, only link to the given directory") @click.option('--force', '-f', default=False, is_flag=True, help="Overwrite files existing in checkout directory") -@click.option('--source', '-s', default=None, +@click.option('--source', '-s', default=None, type=click.INT, metavar='INDEX', help="The source to create a workspace for. Projects with one source may omit this") @click.option('--variant', help='A variant of the specified target') @@ -515,7 +515,7 @@ def workspace_open(app, no_checkout, force, source, variant, track, element, dir # Workspace Close Command # ################################################################## @workspace.command(name='close', short_help="Close a workspace") -@click.option('--source', '-s', default=None, +@click.option('--source', '-s', default=None, type=click.INT, metavar='INDEX', help="The source of the workspace to remove. Projects with one source may omit this") @click.option('--remove-dir', default=False, is_flag=True, help="Remove the path that contains the closed workspace") @@ -545,7 +545,7 @@ def workspace_close(app, source, remove_dir, variant, element): # Workspace Reset Command # ################################################################## @workspace.command(name='reset', short_help="Reset a workspace to its original state") -@click.option('--source', '-s', default=None, +@click.option('--source', '-s', default=None, type=click.INT, metavar='INDEX', help="The source of the workspace to reset. Projects with one source may omit this") @click.option('--track', default=False, is_flag=True, help="Track and fetch the latest source before resetting") |