Module prompts

Module prompts 

Source
Expand description

Interactive prompts for CLI commands.

This module provides reusable interactive prompt functions with enhanced features including fuzzy search, better validation, and improved visual feedback.

§What

Provides interactive prompts for:

  • Package selection (multi-select with fuzzy search)
  • Bump type selection (single select with descriptions)
  • Environment selection (multi-select with fuzzy search)
  • Summary/message text input (with validation)
  • Confirmation dialogs (with context and warnings)

§How

Uses enhanced modules:

  • select for fuzzy search and multi-select
  • confirm for styled confirmation dialogs
  • validation for input validation with helpful messages
  • theme for consistent visual styling

All prompts are designed to be:

  • User-friendly with clear instructions
  • Fast and responsive with fuzzy search
  • Visually appealing with custom theme
  • Accessible (work in various terminal environments)
  • Cancelable (Ctrl+C returns error)

§Why

Centralizing interactive prompts provides:

  • Consistent UX across all interactive commands
  • Reusable prompt implementations
  • Easy testing with mock implementations
  • Proper error handling for user cancellation
  • Better user experience through enhanced features

§Examples

use sublime_cli_tools::interactive::prompts::{prompt_bump_type, prompt_summary};

// Prompt for bump type
let bump = prompt_bump_type(false)?;
println!("Selected bump type: {}", bump);

// Prompt for summary
let summary = prompt_summary(None, false)?;
println!("Summary: {}", summary);

Functions§

prompt_bump_type
Prompts user to select a bump type with enhanced UI.
prompt_confirm
Prompts user for a yes/no confirmation with enhanced styling.
prompt_confirm_dangerous
Prompts user for confirmation of a dangerous operation.
prompt_confirm_with_context
Prompts user for confirmation with additional context.
prompt_environments
Prompts user to select environments from a list with fuzzy search.
prompt_packages
Prompts user to select packages from a list with fuzzy search.
prompt_summary
Prompts user to enter a summary message with validation.