Interactive¶
lets has built-in support for confirmation prompts, text input, and selection menus. All interactive features can be bypassed with --yes / -y for CI environments.
Confirmation (confirm)¶
Ask for yes/no confirmation before running a command:
The confirmation message supports interpolation:
deploy {
arg environment "staging" "prod"
confirm "Deploy to {environment}?"
run "scripts/deploy.sh {environment}"
}
Text input (prompt)¶
Ask the user for text input, bound to a variable:
Properties:
| Property | Required | Description |
|---|---|---|
| (first positional) | Yes | Variable name |
| (second positional) | No | Prompt message (defaults to "name: ") |
default |
No | Default value (used with --yes) |
Selection menu (choose)¶
Present an interactive selection menu:
deploy {
choose environment "dev" "staging" "prod"
confirm "Deploy to {environment}?"
run "scripts/deploy.sh {environment}"
}
The selected value is bound to the variable name for interpolation.
Combining interactive features¶
Interactive elements are processed in order: choose first, then prompt, then confirm. This allows later elements to reference earlier ones:
release {
choose channel "stable" "beta" "nightly"
prompt version "Version number?"
confirm "Release {version} to {channel}?"
run "scripts/release.sh {channel} {version}"
}
CI mode (--yes)¶
The --yes / -y flag bypasses all interactive prompts:
confirm— automatically answers yesprompt— uses thedefaultvalue (empty string if no default)choose— uses the first choice
This is a global flag — it works on any command:
Prompts without defaults
If a prompt has no default and --yes is used, the variable will be an empty string. Make sure prompts used in CI have sensible defaults.