discover · compare · collections · requirements · contribute · feed · watching · stats · help with your tokens
manifoldco/promptui · source
Snapshot 0 · 2026-11-04T12:47:25Z · Go · BSD-3-Clause
Content fingerprint
f93f45c48845ca4c8efbba5aa76a9d37eb8a07d1f2ddcfb2752771ac7a7715daGitHub description at capture
Interactive prompt for command-line applications
README at capture
# promptui
Interactive prompt for command-line applications.
We built Promptui because we wanted to make it easy and fun to explore cloud
services with [manifold cli](https://github.com/manifoldco/manifold-cli).
[Code of Conduct](./CODE_OF_CONDUCT.md) |
[Contribution Guidelines](./.github/CONTRIBUTING.md)
[](https://github.com/manifoldco/promptui/releases)
[](https://godoc.org/github.com/manifoldco/promptui)
[](https://travis-ci.org/manifoldco/promptui)
[](https://goreportcard.com/report/github.com/manifoldco/promptui)
[](./LICENSE.md)
## Overview

Promptui is a library providing a simple interface to create command-line
prompts for go. It can be easily integrated into
[spf13/cobra](https://github.com/spf13/cobra),
[urfave/cli](https://github.com/urfave/cli) or any cli go application.
Promptui has two main input modes:
- `Prompt` provides a single line for user input. Prompt supports
optional live validation, confirmation and masking the input.
- `Select` provides a list of options to choose from. Select supports
pagination, search, detailed view and custom templates.
For a full list of options check [GoDoc](https://godoc.org/github.com/manifoldco/promptui).
## Basic Usage
### Prompt
```go
package main
import (
"errors"
"fmt"
"strconv"
"github.com/manifoldco/promptui"
)
func main() {
validate := func(input string) error {
_, err := strconv.ParseFloat(input, 64)
if err != nil {
return errors.New("Invalid number")
}
return nil
}
prompt := promptui.Prompt{
Label: "Number",
Validate: validate,
}
result, err := prompt.Run()
if err != nil {
fmt.Printf("Prompt failed %v\n", err)
return
}
fmt.Printf("You choose %q\n", result)
}
```
### Select
```go
package main
import (
"fmt"
"github.com/manifoldco/promptui"
)
func main() {
prompt := promptui.Select{
Label: "Select Day",
Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday"},
}
_, result, err := prompt.Run()
if err != nil {
fmt.Printf("Prompt failed %v\n", err)
return
}
fmt.Printf("You choose %q\n", result)
}
```
### More Examples
See full list of [examples](https://github.com/manifoldco/promptui/tree/master/_examples)