A library of extensible and modular CLI prompt elements
Project description
Questo
Questo is not your ordinary library of CLI elements; It's a framework. It's modular, extensible, Pythonic and brain friendly. You can build your own CLI elements, with custom key-press handling, validation and rendering, all in plain old Python; No magic.
Basic Usage
from questo import select, prompt
from yakh import get_key
selector = select.Select()
selector.state = select.SelectState(
title="Who's your favorite Teletubbie",
options=["Tinky Winky", "Dipsy", "Laa-Laa", "Po", "The Weird Vacuum Thing"],
selected=4
)
with selector.displayed():
while True:
selector.state = select.key_handler(selector.state, get_key())
if selector.state.exit or selector.state.abort:
break
prompter = prompt.Prompt()
prompter.state = prompt.PromptState(
title=f"Why {selector.result}?",
)
with prompter.displayed():
while True:
prompter.state = prompt.key_handler(prompter.state, get_key())
if prompter.state.exit or prompter.state.abort:
break
print(f"Ah, of course: {prompter.result}")
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
questo-0.3.0.tar.gz
(8.0 kB
view details)
Built Distribution
questo-0.3.0-py3-none-any.whl
(10.1 kB
view details)
File details
Details for the file questo-0.3.0.tar.gz
.
File metadata
- Download URL: questo-0.3.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5cf16744b0e490ff93522a45fdd953ffc878d22aea404ff14ec4e9186b64c37 |
|
MD5 | 70e52f3a24168bf2e5ceccbb0e5d0a0f |
|
BLAKE2b-256 | 48c54f6c79f770b12a67eb60d176c727e98312b5fce6f2a41af35bf08465b892 |
File details
Details for the file questo-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: questo-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e1ea5f71058a35edcee49fae2aa4a55b9b28918535ff6d121a505a1f0b0580e |
|
MD5 | 16cbac744ed5d881e57d063d23e948dc |
|
BLAKE2b-256 | d0b774bf83cb431db799a7db6945c42f9ecb12413bcd2e1c577304ea5d450dcb |