Skip to main content

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)

Preview

It's designed to be user-friendly, minimal, and very easy to understand.

Due to its search function, it supports large lists and spares the end-user unnecessary frustration.

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(["Choose me!", "Dare you choose 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 Precision of search. (0 < x < 1).
amount_results INT The maximum amount of search results to return.
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' will return a Selection object which holds following attributes:

print(f"Selected value: {user_choice.value}")
# > "Choose me!" or "Dare you choose 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 ["Dare 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.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

clsp-1.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file clsp-1.3.tar.gz.

File metadata

  • Download URL: clsp-1.3.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for clsp-1.3.tar.gz
Algorithm Hash digest
SHA256 35263bdb6653e78d7ac272b0e6ae9c5e0d8ba71fe0287991b784ab796f75673f
MD5 6de3dc3d51f69f1439298a247ec463dc
BLAKE2b-256 825976897b7d89076e524a1c17e7f5e5d6563ad0504e998bf66b2758aea94d79

See more details on using hashes here.

File details

Details for the file clsp-1.3-py3-none-any.whl.

File metadata

  • Download URL: clsp-1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for clsp-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7dec2fa29220d91d8a1b3a5777bd68458bba732c8cdda38a919cb253d735a57b
MD5 39826946629148e275457fcfb0d04879
BLAKE2b-256 e90dfb8b3aa7fcba01da4183f23c5bb69ac095286a953bb738e08f94315712fb

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