Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

promptui

> 开发工具
Open source

Interactive prompt for command-line applications

6.4K stars0 likes1 views
WebsiteGitHub

About

Interactive prompt for command-line applications

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.

Code of Conduct | Contribution Guidelines

Overview

Promptui is a library providing a simple interface to create command-line prompts for go. It can be easily integrated into spf13/cobra, 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.

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

Issues· 91 open

View all issuesOpen on GitHub
  • #244

    go.mod dependencies are severely outdated (go 1.12, pre-module commit pins)

    Updated Sep 16, 2026
  • #241

    Add an option for a default Select search?

    Updated Jan 14, 2026
  • #233

    When using prompt, after inputing content and pressing Enter, the program repeats the output line.

    Updated Dec 1, 2025
  • #81

    IsConfirm generates error if response is not "y"

    Updated Aug 13, 2025
  • #239

    Fixed bug in New function in list.go

    Updated Jun 20, 2025
  • #229

    Is this project still maintained?

    Updated May 14, 2024
  • #211

    Stdout should be `io.Writer` instead of `io.WriterCloser`

    Updated Apr 17, 2024
  • #129

    Duplicate prompt line

    Updated Feb 18, 2024
  • #230

    [Feature Request] Select: Add ability to insert spaces/empty lines

    Updated Feb 8, 2024
  • #161

    ctrl+v is not working in window terminal when i want to paste some value

    Updated Dec 28, 2023

> Tags

Goclicommand-linegolanginput

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 24, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具