Skip to main content

Menu for command line

Project description

terminaloptions

Menu for command line applications.

Installation

pip install terminaloptions

Usage

from terminaloptions import Menu

options = [
    'Option 1',
    'Option 2',
    'Option 3',
]

menu = Menu(options) # Create a new menu.

# Running menu will print the options and wait for the user to select one.
# Use the arrow keys to navigate and enter to select.

selection = menu.run_menu() # Returns the selected option.

Other arguments for run_menu method:

  • title: str | None = None -> Show a title for the menu.
  • get_index: bool = False -> Return the index of the selected option.
  • help: bool = True -> Show a short help message at the top of the menu.

Next features

  • [ ] Add support for submenus.
  • [ ] Customise the appearance of the menu.
  • [ ] Add support for custom key bindings.
  • [ ] Add support for custom actions.
  • [ ] Add support for custom help messages.

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

terminaloptions-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

terminaloptions-1.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file terminaloptions-1.0.1.tar.gz.

File metadata

  • Download URL: terminaloptions-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for terminaloptions-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0b0a33caa3fd53100aa2dede038749abd8888bacafcade44864715f8def8296e
MD5 073871bb3f4fcd7e6815e773e8889e5b
BLAKE2b-256 c27005b33316b28cad90104af6ef22318f53301948eed84769cc029c792d7d42

See more details on using hashes here.

File details

Details for the file terminaloptions-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for terminaloptions-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da5d4381a5622217efa8edd59aee9dfd391582a3d3e242df15a19b35a9ea6706
MD5 1ee88b6b1057a0120503dd8609e9354a
BLAKE2b-256 5baff39a0e217b85802787c90059baa098a40151a947d9ea68d064b89e316de0

See more details on using hashes here.

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