Module select

Module select 

Source
Expand description

Enhanced selection prompts with fuzzy search.

This module provides enhanced selection prompts that support fuzzy search, better visual indicators, and improved user experience for package and environment selection.

§What

Provides:

  • Fuzzy search for filtering large lists of items
  • Enhanced multi-select with better visual feedback
  • Single-select with search capability
  • Pre-selection based on detected changes
  • Clear instructions and help text

§How

Uses:

  • fuzzy-matcher for fuzzy string matching
  • dialoguer for terminal interaction
  • Custom theme for consistent styling
  • Real-time filtering as user types

The fuzzy search allows users to quickly narrow down large lists by typing a search query. Results are ranked by relevance and displayed in real-time.

§Why

Enhanced selection improves UX by:

  • Making it easy to find items in large lists
  • Reducing cognitive load through filtering
  • Providing immediate visual feedback
  • Supporting keyboard-driven workflows

§Examples

use sublime_cli_tools::interactive::select::{fuzzy_select, fuzzy_multi_select};

let items = vec!["package-a", "package-b", "package-core", "utils"];

// Single select with fuzzy search
let selection = fuzzy_select("Select a package", &items, None, false)?;
println!("Selected: {}", items[selection]);

// Multi-select with fuzzy search and defaults
let defaults = vec![0, 1]; // Pre-select first two items
let selections = fuzzy_multi_select("Select packages", &items, &defaults, false)?;
println!("Selected: {} items", selections.len());

Functions§

fuzzy_filter
Filters items using fuzzy matching and returns ranked results.
fuzzy_multi_select
Performs a multi-selection with fuzzy search capability.
fuzzy_select
Performs a single selection with fuzzy search capability.
select_environments
Performs a multi-selection with fuzzy filtering by environment names.
select_packages
Performs a multi-selection with fuzzy filtering by package names.
simple_select
Performs a single selection without fuzzy search.