Skip to main content

CHOOSE OPTIONS

A simple CLI checkbox menu interface for choosing options.

img

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}

Metadata

Release files for chopt 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chopt 0.0.6
File Size Uploaded
chopt-0.0.6.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chopt 0.0.6
File Interpreter ABI Platform
chopt-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / chopt-0.0.6.tar.gz

Download URL chopt-0.0.6.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f748809a12c15ea6294b7a36c6e52be38fa7dffb38b0338dd528136df5e761c9
BLAKE2b-256 checksum
How to use checksums
2d4540fdb750386d42e8a1c818923e09ba405f9dbbb9a780d3bbc33578e1efba
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / chopt-0.0.6-py3-none-any.whl

Download URL chopt-0.0.6-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29c0a7291a1b3e1e1f97a1673318bc482f302c2c6e883dac41ad0fde556810f5
BLAKE2b-256 checksum
How to use checksums
0d4c33966dfe7e47ce59c7a2a083cd2d6715387b15a1d29b808e685652c436cb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page