puissant 0.1.0

Last updated:

0 purchases

puissant 0.1.0 Image
puissant 0.1.0 Images
Add to Cart

Description:

puissant 0.1.0

validated user input over command line the easy way
puissant is a collection of Python functions to implement validated user input
from command line


Dependencies

Python version required: 3.7+
If documentation is to be generated sphinx and sphinx_rtd_theme packages are required:

pip install sphinx sphinx_rtd_theme


Installation
Simply type
pip install puissant


Documentation
Documentation can be found @ readthedocs


Examples

yes/no question

>>> from puissant import *
>>> yes_no(prompt = "Are you happy")
Are you happy [y/n]?maybe
input must be one of y, n, yes, no.
Are you happy [y/n]?yes
True

yes/no question with default value

>>> yes_no(prompt = "Are you happy", default = 'y')
Are you happy [y/n]?(default:y) True

Single option menu:

>>> menu(prompt = 'what next?', options = ['restart', 'continue', 'quit'])
what next?
1 - restart
2 - continue
3 - quit
select an item [range: 1..3]: 4
input must be in range 1..3.
select an item [range: 1..3]: quit
input must be of type int.
select an item [range: 1..3]: 1
'restart'

Tickbox (multiple selection) menu:

>>> tickbox_menu('add extras', ['mayo', 'ketchup', 'garlic', 'tabasco'])
add extras
1 [ ] - mayo
2 [ ] - ketchup
3 [ ] - garlic
4 [ ] - tabasco

- type a number to tick the option.
- "a" selects all.
- "n" de-selects all.
- "d" selection done.

Option? : 1
add extras
1 [x] - mayo
2 [ ] - ketchup
3 [ ] - garlic
4 [ ] - tabasco

- type a number to tick the option.
- "a" selects all.
- "n" de-selects all.
- "d" selection done.

Option? : 3
add extras
1 [x] - mayo
2 [ ] - ketchup
3 [x] - garlic
4 [ ] - tabasco

- type a number to tick the option.
- "a" selects all.
- "n" de-selects all.
- "d" selection done.

Option? : d
[(0, 'mayo'), (2, 'garlic')]

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.