automation-tests/common/vendor/github.com/manifoldco/promptui
dependabot[bot] 88b90f03e9 build(deps): bump github.com/containers/image/v5 from 5.16.1 to 5.17.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.16.1 to 5.17.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.16.1...v5.17.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 04:32:19 +00:00
..
list new libimage package 2021-04-21 11:17:47 +02:00
screenbuf new libimage package 2021-04-21 11:17:47 +02:00
.gitignore new libimage package 2021-04-21 11:17:47 +02:00
.golangci.yml new libimage package 2021-04-21 11:17:47 +02:00
.travis.yml new libimage package 2021-04-21 11:17:47 +02:00
CHANGELOG.md build(deps): bump github.com/containers/image/v5 from 5.16.1 to 5.17.0 2021-11-23 04:32:19 +00:00
CODE_OF_CONDUCT.md new libimage package 2021-04-21 11:17:47 +02:00
LICENSE.md new libimage package 2021-04-21 11:17:47 +02:00
Makefile new libimage package 2021-04-21 11:17:47 +02:00
README.md new libimage package 2021-04-21 11:17:47 +02:00
codes.go new libimage package 2021-04-21 11:17:47 +02:00
cursor.go new libimage package 2021-04-21 11:17:47 +02:00
go.mod build(deps): bump github.com/containers/image/v5 from 5.16.1 to 5.17.0 2021-11-23 04:32:19 +00:00
go.sum build(deps): bump github.com/containers/image/v5 from 5.16.1 to 5.17.0 2021-11-23 04:32:19 +00:00
keycodes.go new libimage package 2021-04-21 11:17:47 +02:00
keycodes_other.go new libimage package 2021-04-21 11:17:47 +02:00
keycodes_windows.go new libimage package 2021-04-21 11:17:47 +02:00
prompt.go new libimage package 2021-04-21 11:17:47 +02:00
promptui.go new libimage package 2021-04-21 11:17:47 +02:00
select.go build(deps): bump github.com/containers/image/v5 from 5.16.1 to 5.17.0 2021-11-23 04:32:19 +00:00
styles.go new libimage package 2021-04-21 11:17:47 +02:00
styles_windows.go new libimage package 2021-04-21 11:17:47 +02:00

README.md

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

GitHub release GoDoc Travis Go Report Card License

Overview

promptui

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

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

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