Skip to content
This repository was archived by the owner on Mar 31, 2024. It is now read-only.
Open
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
14 changes: 6 additions & 8 deletions clint/textui/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,17 @@ def yn(prompt, default='y', batch=False):
input = ''

# If input is empty default choice is assumed
# so we return True
# We return True if default is 'y' , False otherwise
if input == '':
return True
return True if default == 'y' else False

# Given 'yes' as input if default choice is y
# then return True, False otherwise
# Return True if given 'yes' as input
if match('y(?:es)?', input, I):
return True if default == 'y' else False
return True

# Given 'no' as input if default choice is n
# then return True, False otherwise
# Return False if given 'no' as input
elif match('n(?:o)?', input, I):
return True if default == 'n' else False
return False


def query(prompt, default='', validators=None, batch=False):
Expand Down