Thanks to visit codestin.com
Credit goes to lib.rs

4 releases (2 breaking)

0.3.0 Apr 4, 2026
0.2.1 Jul 27, 2024
0.2.0 Jul 13, 2024
0.1.0 Jul 12, 2024

#1581 in Text processing


Used in iforgor

MIT/Apache

28KB
566 lines

ichoose

ichoose crate ichoose documentation

A TUI interactive selection menu built on ratatui. Used by iforgor, 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.

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

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.

Dependencies

~6.5MB
~107K SLoC