Allow uppercase "Y" and "N" as answers to boolean questions

This commit is contained in:
Régis Behmo 2019-04-09 13:38:56 -07:00
parent 695cc0d18a
commit becd03cbf8
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## Latest
- [Improvement] Allow uppercase "Y" and "N" as answers to boolean questions
## v3.3.4 (2019-04-09)
- [Improvement] Rename `--silent` option to `-y/--yes`

View File

@ -186,9 +186,9 @@ def ask_bool(question, key, config):
suffix = " [Yn]" if config[key] else " [yN]"
answer = click.prompt(
fmt.question(question) + suffix,
type=click.Choice(["y", "n"]),
type=click.Choice(["y", "Y", "n", "N"]),
prompt_suffix=" ", default=default, show_default=False, show_choices=False,
)
).lower()
config[key] = answer == "y"
def ask_choice(question, key, config, choices):