prompt
Shared interactive prompts for CLI subcommands.
These helpers centralize the wording and input parsing used by destructive
commands so that behavior (and scriptable --yes bypass semantics) stay
consistent across subcommands.
fn confirm_destructive
pub fn confirm_destructive(action: &str, target: &str, yes: bool) -> Result<bool, Error>Prompt the user to confirm a destructive action against target.
When yes is true the prompt is skipped and Ok(true) is returned,
matching the scriptable --yes / --force convention used across the CLI.
Otherwise an interactive Yes/No selector is rendered using crossterm for
raw terminal input. The default selection is No.
| Parameter | Type | Description |
|---|---|---|
action |
&str | the verb shown in the prompt, such as delete |
target |
&str | what the action applies to, such as task abc123 |
yes |
bool | skip the prompt and confirm, as --yes does |
| returns | Result<bool, Error> | true when the user confirms, false when the user declines, or an error when the terminal cannot be read. |