Choose Options using a CLI Checkbox Menu
Project description
CHOOSE OPTIONS
A simple CLI checkbox menu interface for choosing options.
Takes a list of options as an argument and returns a list of selected items from that list.
Options are chosen by entering their corresponding number or name. Multiple options can be selected in one go. Choices should be separated by spaces.
Also supported is specifying ranges of numbers, in the form x..y or x-y (where x and y are item numbers from the list, eg) 1..5 or 1-5).
Additionally you can use ..x or -x to specify everything up to the number x, and x.. or x- to specify everything from the number x until the last element.
Finally one can use wildcard globbing to match option name strings. For instance *.py would match all files with the extension .py.
Reserved words are toggle, reset, accept and quit (case insensitive). They can be used to carry out those respective actions. Typing just the first letter also carries out that action - ie) t, toggles all, r, resets, etc.
INSTALLATION
pip install chopt
CLI USAGE
usage: chopt [-h] options [options ...]
Create a checkbox menu from a list of options.
positional arguments:
options Options for the menu.
optional arguments:
-h, --help show this help message and exit
PYTHON USAGE
from chopt import chopt
my_list = [ 'item1', 'item2', 'item3' ]
chosen = chopt(my_list)
some_interesting_function(chosen)
EXAMPLES
chopt $(ls ~/src/chopt)
chopt $(shuf -n 100 /usr/share/dict/words)
chopt options{1..100}
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
Built Distribution
File details
Details for the file chopt-0.0.6.tar.gz
.
File metadata
- Download URL: chopt-0.0.6.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f748809a12c15ea6294b7a36c6e52be38fa7dffb38b0338dd528136df5e761c9 |
|
MD5 | ef2ad7edc4964b77eb404308f0ec692b |
|
BLAKE2b-256 | 2d4540fdb750386d42e8a1c818923e09ba405f9dbbb9a780d3bbc33578e1efba |
File details
Details for the file chopt-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: chopt-0.0.6-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29c0a7291a1b3e1e1f97a1673318bc482f302c2c6e883dac41ad0fde556810f5 |
|
MD5 | 40b6636692157a18b90519377a7d483e |
|
BLAKE2b-256 | 0d4c33966dfe7e47ce59c7a2a083cd2d6715387b15a1d29b808e685652c436cb |