Expand description
Interactive terminal prompts for the remote sources setup wizard.
This module provides rich interactive components using dialoguer, including:
- Multi-select host picker with multi-line item display
- Confirmation prompts for destructive operations
§Design Decision: dialoguer vs inquire
We chose dialoguer because:
- It integrates well with indicatif (already used for progress bars)
- It’s actively maintained and widely used
- It supports ANSI styling in items via the console crate
§Multi-line Item Display
Standard dialoguer MultiSelect shows single-line items. We achieve multi-line display by embedding ANSI escape sequences and newlines directly in item strings:
[x] css
209.145.54.164 • ubuntu
✓ cass v0.1.50 installed • 1,234 sessions
Claude ✓ Codex ✓ Cursor ✓§Example
ⓘ
use coding_agent_search::sources::interactive::{
HostSelector, HostDisplayInfo, HostState, CassStatusDisplay
};
let hosts = vec![
HostDisplayInfo {
name: "css".into(),
hostname: "209.145.54.164".into(),
username: "ubuntu".into(),
cass_status: CassStatusDisplay::Installed { version: "0.1.50".into(), sessions: 1234 },
detected_agents: vec!["claude".into(), "codex".into()],
reachable: true,
error: None,
state: HostState::ReadyToSync,
system_info: Some("ubuntu 22.04 • 45GB free".into()),
},
// ... more hosts
];
let selector = HostSelector::new(hosts);
let selected = selector.prompt()?;Structs§
- Host
Display Info - Display information for a remote host in the selection UI.
- Host
Selection Result - Result of host selection.
- Host
Selector - Interactive multi-select host picker with rich display.
Enums§
- Cass
Status Display - cass installation status for display purposes.
- Host
State - State of a host for selection purposes.
- Interactive
Error - Errors from interactive prompts.
Functions§
- confirm_
action - Ask for confirmation before a destructive operation.
- confirm_
with_ details - Ask for confirmation with a detailed explanation.
- probe_
to_ display_ info - Convert a probe result to display info for the selection UI.
- run_
host_ selection - Run the interactive host selection flow.