cli promt: improve coe for yes/no parsing

This commit is contained in:
Alexandre Aubin 2021-09-03 15:30:35 +02:00 committed by GitHub
parent bd557468d3
commit e08d0139f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -542,9 +542,10 @@ class Interface:
elif is_multiline: elif is_multiline:
while True: while True:
value = input(colorize(m18n.g("edit_text_question", message), color)) value = input(colorize(m18n.g("edit_text_question", message), color))
if value in ["", "n", "N", "no", "NO"]: value = value.lower().strip()
if value in ["", "n", "no"]:
return prefill return prefill
elif value in ['y', 'yes', 'Y', 'YES']: elif value in ['y', 'yes']:
break break
initial_message = prefill.encode('utf-8') initial_message = prefill.encode('utf-8')