| type | Package Documentation |
|---|---|
| title | CoreCLI prompts — interactive input |
| description | Interactive terminal input — Prompt, Select, MultiSelect, the Confirm and Question option builders, and the generic Choose picker |
| repo | core/cli |
| module | dappco.re/go/cli |
Two generations of input helpers live side by side: the plain core.Result-returning primitives in prompt.go, and the option-pattern builders in utils.go (Confirm, Question, Choose) that return plain values. Prompts write to stderr so stdout stays clean for command output; labels and defaults pass through glyph compilation.
r := cli.Prompt("Name", "default") // text input with default; core.Result
r := cli.Select("Pick one", options) // numbered options; returns the selected value
r := cli.MultiSelect("Pick", options) // checkboxes — space-separated numbersPrompt prints label [default]: when a default is supplied and returns the default on empty input. Select validates the numeric choice and re-prompts hints on invalid input.
Yes/no with options:
ok := cli.Confirm("Proceed?")
ok := cli.Confirm("Proceed?", cli.DefaultYes())
ok := cli.Confirm("Proceed?", cli.Required(), cli.Timeout(30*time.Second))
ok := cli.ConfirmAction("delete", "the cache") // i18n-composed "delete the cache" prompt
ok := cli.ConfirmDangerousAction("drop", "the database")Free-text with validation:
name := cli.Question("Project name", cli.WithDefault("app"))
name := cli.Question("Project name", cli.RequiredInput())
port := cli.Question("Port", cli.WithValidator(func(s string) error { /* ... */ }))
val := cli.QuestionAction("name", "the project")Type-safe selection over any slice:
repo := cli.Choose("Repository", repos,
cli.WithDisplay(func(r Repo) string { return r.Name }),
cli.WithDefaultIndex[Repo](0),
)
picked := cli.ChooseMulti("Targets", targets, cli.Display(func(t Target) string { return t.ID }))Options: WithDisplay/Display, WithDefaultIndex, Filter (type-to-filter), Multi. Verb/subject variants ChooseAction and ChooseMultiAction compose the prompt through i18n grammar.
utils.go also carries GhAuthenticated() (checks gh auth status) and GitClone/GitCloneRef process wrappers used by interactive flows such as pkg install.
| File | Contents |
|---|---|
go/pkg/cli/prompt.go |
Prompt, Select, MultiSelect |
go/pkg/cli/utils.go |
Confirm, Question, Choose families and their options; git/gh helpers |