# `ichoose`
[](https://crates.io/crates/ichoose)
[](https://docs.rs/ichoose)
A TUI interactive selection menu built on [ratatui](https://ratatui.rs/). Used by
[iforgor](../iforgor/README.md), but usable standalone as a binary or Rust library.
## Binary usage
Pipe a list to `ichoose` via stdin, one entry per line:
```
ID @ NAME
ID @ NAME @ DESCRIPTION
```
If ` @ ` is not found, the whole line is used as both ID and name. Selected IDs are
printed to stdout, one per line.
```sh
echo -e "a @ Alpha\nb @ Beta\nc @ Gamma" | ichoose --title "Pick one"
# Outputs selected ID, e.g.: b
# Multi-select:
echo -e "1 @ One\n2 @ Two\n3 @ Three" | ichoose --multi --title "Pick many"
```
Flags: `--title <TITLE>`, `--text <TEXT>`, `--multi`.
## Library usage
```rust
let items = vec![
ichoose::ListEntry { key: 0, name: "Alpha".into(), description: None },
ichoose::ListEntry { key: 1, name: "Beta".into(), description: Some("second".into()) },
];
let result = ichoose::ListSearch {
items: &items,
filter_callback: None,
preview_callback: None,
extra: ichoose::ListSearchExtra {
title: " Pick one ".into(),
..Default::default()
},
}
.run()?;
// result.selected: BTreeSet<K> of chosen keys
// result.action: Option<String> if a custom action key was pressed
```
### Features
- **Search**: type to filter by name/description. Comma-separated terms use AND logic.
- **Key:value filters**: `tag:x`, `shell:bash`, etc. via `filter_callback`.
- **Preview pane**: Tab toggles a side panel via `preview_callback`.
- **Multi-select**: Right toggles item, Left toggles all visible.
- **Action keys**: `ActionKey` enum (F-keys, Ctrl+char, Alt+char, etc.) for custom actions that exit the picker with an action name.
- **History list**: `empty_search_list` shows an alternate list when search is empty.
- **Preserved order**: `preserve_order` skips alphabetic sorting.
- **Visual**: rounded borders, reverse-video highlight, scrollbar, item count, block cursor.