Skip to main content

An importable, single stage CLI menu package

Project description

Python Command Line Menu Selector (PyCoLiMS)

A command line interface single stage menu system, designed to display a given list on screen and prompt the user to select from said list. Returns the selected item/s to the calling function in the same format as provided*

In the case of very large lists, PyCoLiMS breaks** the list down into terminal-sized chunks with a paging system, allowing lists larger than the screen to be processed without issue

Has single and multiple selection modes.

* A note on Dictionaries: PyCoLiMS displays and returns only the keys of a dictionary. This allows easy user input to call a dict value

** It's a series of pointers, not a bunch of new lists. PyCoLiMS tries to stay mem friendly!


pip install pycolims

Single Selection menu

import pycolims
menu_single = pycolims.SelectSingle() Union[List[any], 
                                Dict[any, any]], 
                header: str="") -> Union[any, 

Single selection menu returns the one item selected from array_in. This can be a single item or one nested list from array_in.

Multi Seletion Menu

import pycolims
menu_multi = pycolims.SelectMulti() Union[List[any], 
                               List[List[bool, any]],
                               Dict[any, any]], 
                header: str="") -> List[List[bool, any]])

A note on SelectMulti: the multiple selection menu returns the entire array given to it with an embedded boolean prefixing each given item, indicating menu selection status.

 print([val for [val, boolean] in if boolean])

Also of note, SelectMulti is able to parse a given list in the same format, allowing a menu to start with values already indicated

prev_settings = [[True, val_one], 
                 [False, val_two]]

Final notes

This project is still quite young; notable ToDos include wider type acceptance and confirmed stress testing.

This project was inspired by old school "Green Screen" programs used on retail thin clinents. These lightweight programs always facinated me, and I loved navigating to deep submenus with a series of quick keystrokes.

PyCoLiMS is still quite young; all feedback is appreciated.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pycolims, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pycolims-0.1.1-py3-none-any.whl (7.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pycolims-0.1.1.tar.gz (5.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page