Skip to main content

Simple CLI Menus

Project description

a simple CLI menu

There is a single required argument:
* items - a finite iterable (list, tuple, etc) of items which the user will be prompted to choose from

from pimento import menu
result = menu(['red', 'blue', 'green', 'grey'])

Prints:
Options:
red
blue
green
grey
Enter an option to continue:

There are many optional arguments:

from pimento import menu
result = menu(
['RED robin', 'Blue Bonnet', 'green GIANT'],
'Food Sources:',
'Select one [{}]:',
default_index=1,
indexed=True,
insensitive=True,
search=True
)

Prints:
Food Sources:
[0] 'RED robin'
[1] 'Blue Bonnet'
[2] 'green GIANT'
Select one [Blue Bonnet]:

Entering any of the following will get you a result of "Blue Bonnet":
* <enter>
* 1
* Bl
* bonnet

There is a standalone CLI tool of the same name ('pimento'), which is a wrapper for 'pimento.menu', and can be used to create simple menus quickly on the command line.

pimento has been tested on python 2.7.9 and 3.4.3 on OSX.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pimento-0.5.0.tar.gz (5.3 kB view hashes)

Uploaded source

Built Distribution

pimento-0.5.0-py2.py3-none-any.whl (7.0 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page