From fe0bb0a98076725a630a8c7b990916cab317616d Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 27 Jul 2021 10:57:24 +1000 Subject: [PATCH] Fix `choice()` default handling (#40) --- milc/questions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milc/questions.py b/milc/questions.py index ba4aa1e..d5bfef7 100644 --- a/milc/questions.py +++ b/milc/questions.py @@ -164,7 +164,7 @@ def choice(heading, options, *args, default=None, confirm=False, prompt='Please if not milc.cli.interactive: return default - if prompt and default: + if prompt and default is not None: prompt = prompt + ' [%s] ' % (default + 1,) elif prompt[-1] != ' ': prompt += ' ' @@ -182,7 +182,7 @@ def choice(heading, options, *args, default=None, confirm=False, prompt='Please return answer # Massage the answer into a valid integer - if answer == '' and default: + if answer == '' and default is not None: answer = default else: try: