Socket
Socket
Sign inDemoInstall

clsp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clsp

CLSP short for Command Line Selection Prompt, is a by fzf inspired, minimalistic, and fast to navigate single choice prompt.


Maintainers
1

CLSP

CLSP short for Command Line Selection Prompt, is a by fzf inspired, minimalistic, and fast to navigate single choice prompt.

from clsp import select


user_choice = select([1, 2, 3], info="Please pick a number:")

print("You selected:")
print(user_choice)

Preview

CLSP is designed to be user-friendly, minimal, and very easy to understand.

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

It's especially useful if you'd like the user to choose between files, numbers, country codes, and much more.

Documentation

# CLSP can be easily imported using:
from clsp import select

# You can then show the actual prompt by calling the select function while passing a list type as the positional argument.

user_choice = select(["Choose me!", "Dare to choose me!"])

# You can navigate using the arrow key up and the arrow key down while pressing enter to confirm your selection.

You can provide additional key arguments for further configuration:

NameTypeDescription
titleSTRInformation shown above the prompt.
promptSTRText in front of user input.
searchSTRPre-insert text into the input prompt.
currentINTIndex as the default selection.
rowsINTAmount of choices at a time.
cutoffFLOATPrecision of search. (0 < x < 1).
amount_resultsINTThe maximum amount of search results to return.
highlight_colorSTRHighlight color for search (black, red, green, yellow, blue, magenta, cyan, white).
full_exitBOOLExit completely or pass None on KeyBoardInterrupt or ESC.
ignore_warningsBOOLIgnore warnings.
# The function 'select' will return a Selection object which holds following attributes:

print(f"Selected value: {user_choice.value}")
# > "Choose me!" or "Dare to 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 to chose me!"]

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc