Skip to main content

Simple CLI menu library for Python

Project description

cli-menu

Complete interactive CLI menu without external dependencies.


Description

cli-menu is a Python library to easily create interactive command-line menus, compatible with Windows, Linux, and macOS, with no external dependencies.

Features:

  • Keyboard navigation (arrow keys up/down, left/right for paging)
  • Single or multiple selection mode (space bar to check/uncheck)
  • Quit with q or ESC
  • Colored display using ANSI codes
  • Customizable titles and descriptions
  • Automatic pagination
  • Callbacks for specific options
  • Windows and Unix compatible (handles console specifics)

Installation

pip install cli-menu

Basic Usage

from cli_menu import CliMenu

menu = CliMenu(
    options=["Option 1", "Option 2", "Quit"],
    title="=== MAIN MENU ===",
    description="Use arrow keys and Enter to navigate.",
    multiselect=False
)

choice = menu.show()
print(f"You selected: {menu.options[choice]}")

Main Parameters

Parameter Type Description Default
options list[str] List of options displayed in the menu Required
title str Title displayed above the menu None
description str Description displayed below the title None
multiselect bool Enable multiple selection with space bar False
page_size int Max number of options displayed per page 10
color bool Enable ANSI color output True
exit_keys list[str] Keys to exit menu (e.g., q, ESC) ['q', '\\x1b']
callbacks dict[int, func] Functions triggered on option selection {}

Methods

 show()

Displays the menu and handles keyboard interaction. Returns:

  • Selected index (int) in single-select mode

  • List of selected indices (list[int]) in multi-select mode

  • None if user exits with an exit key

Author

Gaetan Lerley -- Hostinfire@gmail.com

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

easyclimenu-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easyclimenu-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file easyclimenu-0.1.0.tar.gz.

File metadata

  • Download URL: easyclimenu-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for easyclimenu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5980a020b2ee08572a2a2beea0e41ce4cd10c31ecd930d98ece86850954a4f6
MD5 62eca9c75de4bde2afaea1a10b0eb71c
BLAKE2b-256 d2618dc186d3668cb4dcdb357f6b10301eb0e2bd5c3de6969097100fbf94a8b5

See more details on using hashes here.

File details

Details for the file easyclimenu-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: easyclimenu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for easyclimenu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 320284c1d7af50ddd4118626e7eda1e8c890755dd21baf4b8317ac717c872bf0
MD5 8be4ecae83d8fd3fc9e3d43a142d2ec6
BLAKE2b-256 c75ea91a318a90543345ca9ebf9416120dc262da84eb820516bacf4ae9a86492

See more details on using hashes here.

Supported by

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