CLSP short for Command Line Selection Prompt, is a minimalistic and fast to navigate single choice interface.
Project description
CLSP
CLSP short for Command Line Selection Prompt, is a minimalistic and fast to navigate single choice interface.
from clsp import select
user_choice = select([1, 2, 3], info="Please pick a number:")
print("You selected:")
print(user_choice)
It's designed to be user-friendly, minimal, and very easy to understand.
Whether you want the user to choose a file, number, country code, you name it. It will fulfill its purpose.
Documentation
# CLSP can be easily imported by using:
from clsp import select
# You can then show the actual prompt by calling the select function while passing a list type as the argument.
user_choice = select(["Chose me!", "Dear you chose me!"])
# You can navigate using the arrow key up and the arrow key down + enter to confirm your selection.
You can provide additional key arguments for further configuration:
Name | Type | Description |
---|---|---|
title | STR | Information shown above the prompt. |
prompt | STR | Text in front of user input. |
search | STR | Pre-insert text into the input prompt. |
current | INT | Index as the default selection. |
rows | INT | Amount of choices at a time. |
cutoff | FLOAT | Precsion of search. (0 < x > 1). |
highlight_color | STR | Highlight color for search (black, red, green, yellow, blue, magenta, cyan, white). |
full_exit | BOOL | Exit completely or pass None on KeyBoardInterrupt or ESC. |
ignore_warnings | BOOL | Ignore warnings. |
# The function 'select' fill return a Selection object which holds following attributes:
print(f"Selected value: {user_choice.value}")
# > "Chose me!" or "Dear you chose me!"
print(f"Index: {user_choice.index}")
# > 0 or 1
if user_choice.search:
print(f"Search-Query: {user_choice.search}")
# > For example 'Dare'
print(f"Search Result: {user_choice.search_result}")
# > For example ["Dear you chose me!"]
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
clsp-1.1.tar.gz
(5.8 kB
view hashes)
Built Distribution
clsp-1.1-py3-none-any.whl
(6.5 kB
view hashes)