valinta

Crates.iovalinta
lib.rsvalinta
version0.2.0
created_at2025-12-11 09:12:08.696466+00
updated_at2025-12-29 09:48:28.801576+00
descriptionValinta a zero config Rust crate 🦀 for multiple selection in the terminal
homepagehttps://github.com/vi17250/valinta
repositoryhttps://github.com/vi17250/valinta
max_upload_size
id1979397
size38,778
Victor 💡 (vi17250)

documentation

https://github.com/vi17250/valinta

README

[x] Valinta

Valinta a zero config Rust crate 🦀 for multiple selection in the terminal

🎞️ Example

valinta

📚 Usage

First: add this crate to your project

cargo add valinta

Next:

use valinta::select;

fn main() -> std::io::Result<()> {

    let animals = vec![
        "🦍 gorilla",
        "🪼 jellyfish",
        "🦁 lion",
        "🐝 honeybee",
        "🐗 boar",
        "🦇 bat",
        "🐌 snail",
        "🐨 koala",
        "🦉 owl",
        "🐢 turtle",
        "🐬 dolphin",
    ];

    let selected_animals = select(&animals).expect("Error message");

    Ok(())
}

Or by using ValintaError

use valinta::{select, ValintaError};
fn main() -> Result<(), ValintaError> {

    let animals = vec![
        "🦍 gorilla",
        "🪼 jellyfish",
        "🦁 lion",
        "🐝 honeybee",
        "🐗 boar",
        "🦇 bat",
        "🐌 snail",
        "🐨 koala",
        "🦉 owl",
        "🐢 turtle",
        "🐬 dolphin",
    ];

    let selected_animals = select(&animals)?;

    Ok(())
}

👩‍💻 User interactions

key pressed Action
Next item
Previous item
a or A Select all
n or N Deselect all
i or I Invert selection
space Toggle current
enter Confirm selection
esc Break

🪇 Returned type

A tupple which include the selected items and the indexes of selected data

pub type Returned<T> = (Vec<T>, Vec<usize>);
Commit count: 0

cargo fmt