-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
f:promptfeature: prompt for inputfeature: prompt for input
Description
I am faced with the following problem. Imagine the following dummy script:
#!/usr/bin/env python
import click
@click.command()
@click.option('--name', prompt=True)
def main(name):
click.echo(name)
if __name__ == '__main__':
main()
When invoked with an unexpected argument, e.g. test.py extra_argument instead of failing straight away, first the prompt is invoked. When the prompt is responded to, only then does the command fail:
Name: test
Usage: test_argument.py [OPTIONS]
Try "test_argument.py --help" for help.
Error: Got unexpected extra argument (extra)
Now for a single option, this is not a big deal. However, in our application we have a command with many options with prompt. If the user accidentally pass an argument, they first have to respond to all the prompts only for the command to error out straight after and they have to start all over again.
Is there any way to prioritize parsing of all parameters before hitting prompts of incomplete ones?
MrGreenTea, janluke and heeplr
Metadata
Metadata
Assignees
Labels
f:promptfeature: prompt for inputfeature: prompt for input