Cues
Elegant and sophisticated prompts to inquire and ask questions at the command line.
Compatibility
| Windows | macOS | Linux |
|---|---|---|
| ✔ | ✔ | ✔ |
Installation
You can install Cues by using pip:
pip install cues
Examples
Select
You can use the Select class to create a prompt that asks the user to select a single option among a list of them, allowing the user to shuffle through them by using the arrow keys.
If you would like to to see an example of this in action, you can run the following command in your terminal:
python -m cues.select
Here's some example code showing how you could create a Select prompt:
from cues import Select
name = 'programming_language'
message = 'Which of these is your favorite programming language?'
options = ['Python', 'JavaScript', 'C++', 'C#']
cue = Select(name, message, options)
answer = cue.send()
print(answer)
This produces the following output:
Confirm
You can use the Confirm class to create a prompt that displays a message to the user and then asks them to enter y (Yes) or N (No).
If you would like to to see an example of this in action, you can run the following command in your terminal:
python -m cues.confirm
Here's some example code showing how you could create a Confirm prompt:
from cues import Confirm
name = 'continue'
message = 'Are you sure you want to continue?'
cue = Confirm(name, message)
answer = cue.send()
print(answer)
This produces the following output:
Form
You can use the Form prompt to display a series of fields for the user to answer and fill out.
If you would like to to see an example of this in action, you can run the following command in your terminal:
python -m cues.form
Here's some example code showing how you could create a Form prompt:
from cues import Form
name = 'basic_info'
message = 'Please fill out the following form:'
fields = [
{
'name': 'first_name',
'message': 'What is your first name?',
'default': 'Giovanni'
},
{
'name': 'last_name',
'message': 'What is your last name?',
'default': 'Salinas'
},
{
'name': 'birthday',
'message': 'What is your favorite programming language?'
}
]
cue = Form(name, message, fields)
answer = cue.send()
print(answer)
This produces the following output:
Survey
You can use the Survey class to display a series of questions to the user and have them give a rating based on a scale that you provide.
If you would like to to see an example of this in action, you can run the following command in your terminal:
python -m cues.survey
Here's some example code showing how you could create a Survey prompt:
from cues import Survey
name = 'customer_satisfaction'
message = 'Please rate your satisfaction with the following areas:'
scale = [1, 2, 3, 4, 5]
fields = [
{
'name': 'customer_service',
'message': 'Customer service'
},
{
'name': 'restaurant_service',
'message': 'Restaurant service'
},
{
'name': 'bar_service',
'message': 'Bar service'
},
{
'name': 'room_service',
'message': 'Room service'
}
]
cue = Survey(name, message, scale, fields)
answer = cue.send()
print(answer)
This produces the following output:
Checkbox
You can use the Checkbox class to give a user a list of options and have them select as many as they would like by using the spacebar.
If you would like to to see an example of this in action, you can run the following command in your terminal:
python -m cues.checkbox
Here's some example code showing how you could create a Checkbox prompt:
from cues import Checkbox
name = 'guitars'
message = 'Pick your favorite guitars:'
options = [
'Les Paul',
'Stratocaster',
'Telecaster',
'SG',
'Flying V',
'Acoustic',
'Classical',
]
cue = Checkbox(name, message, options)
answer = cue.send()
print(answer)
This produces the following output:
Password
You can use the Password class when you need input from the user but would prefer their input be hidden while they type as it may contain sensitive information.
If you would like to to see an example of this in action, you can run the following command in your terminal:
python -m cues.password
from cues import Password
name = 'password'
message = 'Password:'
cue = Password(name, message)
answer = cue.send()
print(answer)
This produces the following output:
To Do
- JSON prompt
- Checkbox prompt
- Password prompt
...amongst other things!
Metadata
Release files for cues 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cues-0.3.0.tar.gz | 27.5 kB | Without provenance | Details for cues-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cues-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for cues-0.3.0-py3-none-any.whl |
Total release size: 65.5 kB
Release files / cues-0.3.0.tar.gz
| Download URL | cues-0.3.0.tar.gz |
|---|---|
| Size | 27.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec9137c73bc6416463248ba06bb9fbb3f01500cb2c172ff19446294e2c2d6720
|
|
BLAKE2b-256 checksum How to use checksums |
c56a90d8f2f6d2bbc44987d06b0048f95d45af5a666e632dcabea0968bdc0e12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.1
|
Release files / cues-0.3.0-py3-none-any.whl
| Download URL | cues-0.3.0-py3-none-any.whl |
|---|---|
| Size | 38.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01946c5380af2272100a8713b93e4c6f9980f8e04014ed14f86479f690315d2f
|
|
BLAKE2b-256 checksum How to use checksums |
b62481bfead55cfcad27cd470ba47988c5c034e94dcfc50585d720fcd6645775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.1
|
Security for cues 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.