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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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