Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix choice() default handling #40

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions milc/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += ' '
Expand All @@ -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:
Expand Down