Selthi
selthi is a library for building interactive prompts, inspired by inquire.
It provides two prompts, one for asking the user to select one option from a given list, with the ability to display images for each option, and other prompt for asking the user for a string.
Demo
Examples
Examples can be found in the examples
directory. Run them to see basic behavior:
cargo run --example images --features with_images
Usage
Add Selthi to your dependencies.
cargo add selthi
* If you want to support images, add the feature with_images
selthi = { version = "0.2.7", features = ["with_images"] }
Prompts
Currently, there are 2 different prompt types supported.
Input
Input
displays a message to the user, prompting them to type something back. The user's input is then stored in a String and returned to the prompt caller.
let ans = new.prompt;
match ans
Select
Select
prompts are suitable for when you need the user to select one option among many.
let options: = vec!;
let ans = new.prompt;
match ans
You can also display images when users are choosing the options.
let options: = vec!;
let images: = vec!;
let ans = new
.with_images
.without_help_message
.prompt;
match ans