CLI tool for selecting and executing functions.
Project description
ItemList
ItemList provides a tool for selecting and executing functions in a CLI environment. It offers an intuitive interface for managing and executing multiple workflows or tasks efficiently.
1. Simple Decorator-Based Integration
-
Functions can be added to the menu simply by using the @item decorator. It requires minimal changes to existing functions to integrate them into the CLI menu.
Example Code:
@item # only this! def flow_runner(): print("Flow 1 is running...") @item def flow2_runner(): print("Flow 2 is running...")
2. Intuitive CLI Interface
- Utilizing the curses library, users can navigate through options smoothly with arrow keys or
j
/k
. The currently selected item is displayed in bold for better visibility.
3. Efficient Search Functionality
- The menu includes a search bar, allowing users to filter options by function name or description. This makes it easy to quickly find the desired function, even among numerous options.
4. Function Registration with Descriptions
- Each function can be registered with an optional description. This allows users to easily understand the purpose or details of each task, reducing the chance of incorrect selections.
Installation
pip install itemlist
Usage
More details can be found in the examples directory.
from itemlist import item
@item
def flow_runner(description="Run the first flow"):
run_locally(flow)
@item
def flow2_runner(description="Run the second flow"):
run_locally(flow2)
@item
def flow3_runner(description="Run the third flow"):
run_locally(flow3)
if __name__ == '__main__':
selected = item.select()
item.endwin()
selected_name, selected_func, selected_func_description = selected
if selected_func == item._cancel:
print("Cancel selected. Exiting the program.")
else:
print(f"Running: {selected_name}\n")
print(f"Description: {selected_func_description}\n")
selected_func()
License
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
itemlist-0.1.5.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file itemlist-0.1.5.tar.gz
.
File metadata
- Download URL: itemlist-0.1.5.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
c9126d1662e7caee4d0d81de3df0bff2d1d40d1865698a9e7fa6ac73878cc0dc
|
|
MD5 |
bb1f159213183209fc74c938f262feb3
|
|
BLAKE2b-256 |
95a822eee4bccee80e5a3d7173ffffe888529af171cce0035988749742440495
|
File details
Details for the file itemlist-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: itemlist-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
312f1a8afd7a775df85a9e00fbb0a4d29f2cd1217cab15980174471dc83239aa
|
|
MD5 |
d509e4ae3802fbd4477e296d9160d889
|
|
BLAKE2b-256 |
a04b51ad7f75eebd11ab9ea55077625378a8510ed2551f5b4001cc50242668ad
|