| Crates.io | valinta |
| lib.rs | valinta |
| version | 0.2.0 |
| created_at | 2025-12-11 09:12:08.696466+00 |
| updated_at | 2025-12-29 09:48:28.801576+00 |
| description | Valinta a zero config Rust crate 🦀 for multiple selection in the terminal |
| homepage | https://github.com/vi17250/valinta |
| repository | https://github.com/vi17250/valinta |
| max_upload_size | |
| id | 1979397 |
| size | 38,778 |
Valinta a zero config Rust crate 🦀 for multiple selection in the terminal
cargo add valinta
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(())
}
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(())
}
| 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 |
A tupple which include the selected items and the indexes of selected data
pub type Returned<T> = (Vec<T>, Vec<usize>);