Skip to content

Comments

Added boolean prompt type#1

Open
terrabitz wants to merge 1 commit intosfischer13:masterfrom
terrabitz:master
Open

Added boolean prompt type#1
terrabitz wants to merge 1 commit intosfischer13:masterfrom
terrabitz:master

Conversation

@terrabitz
Copy link

Added ability to simply create boolean-based response (i.e. a 'yes' or 'no' answer). This is to simplify the common task of asking for y/n answers without needing to manually interpret the character. This also includes a default argument that allows a default response to be selected if there is nothing entered by the user. Otherwise, the prompt is displayed again. Here are several examples of this:

$>> boolean('Are you sure you want to update?', default=True)
Are you sure you want to update? (Y/n): 
True

$>> boolean('Would you like to delete the directory', default=False)
Would you like to delete the directory (y/N): y
True

$>> boolean('Should the new version be installed?')
Should the new version be installed? (y/n): 
Should the new version be installed? (y/n): y
True

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.9%) to 23.913% when pulling 68b645b on terrabitz:master into d2acf5d on sfischer13:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants