cli_select

Crates.iocli_select
lib.rscli_select
version0.1.6
sourcesrc
created_at2022-01-25 19:54:32.452316
updated_at2023-10-15 13:51:11.376227
descriptionA crate build on top of crossterm to provide a simple customizable select dialog for the command line.
homepage
repositoryhttps://github.com/Preyde/cli_select/
max_upload_size
id521040
size27,905
(Preyde)

documentation

README

cli_select

A crate build on top of crossterm to provide a simple customizable select dialog for the command line.


Example

Cargo.toml

[dependencies]
cli_select = "0.1.4"

Basic

main.rs

use cli_select::Select;

fn main() {

    let items = vec!["item1", "item2", "item3"];

    let select = Select::new(&items);

    let selected_item = select.start();

    println!("You selected: {}", selected_item);
}

Output

> item1
  item2
  item3
  You selected: item1

Customized

main.rs


use cli_select::Select;

fn main() {

    let items = vec!["item1", "item2", "item3"];

    let select = Select::new(&items);

    let selected_item = select        
        .pointer('◉')
        .not_selected_pointer('🞅')
        .move_selected_item_forward()
        .start();

    println!("You selected: {}", selected_item);
}

Output

◉  item1
🞅 item2
🞅 item3
You selected: item1
Commit count: 30

cargo fmt