• Stars
    star
    5,921
  • Rank 6,819 (Top 0.2 %)
  • Language
    Go
  • License
    BSD 3-Clause "New...
  • Created about 7 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

torus-cli

A secure, shared workspace for secrets
Go
612
star
2

heighliner

Continuous Delivery from GitHub to your Kubernetes cluster
Go
286
star
3

awesome-cloud-native-tutorials

A curated list of tutorials and labs for learning cloud native concepts
73
star
4

manifold-cli

Manage your services and config from the command line
Go
45
star
5

healthz

Easily add health checks to your go services
Go
23
star
6

manifold-laravel

Manifold configuration module for PHP framework Laravel
PHP
21
star
7

kubernetes-credentials

Kubernetes CRD to load Manifold Credentials as Secrets
Go
21
star
8

graphql-gen

Generate GraphQL schemas from Swagger OpenAPI specs
TypeScript
20
star
9

react-select-zero

Zero-dependency alternative to react-select
TypeScript
17
star
10

ui

Manifold’s web component UI library
TypeScript
14
star
11

terraform-provider-manifold

Terraform Manifold Provider
Go
14
star
12

ansiwrap

ANSI escape sequence / unicode aware text wrapping for Go
Go
10
star
13

sowhatsnew

So, what's new? A monorepo code delta tool for Go
Go
10
star
14

definitely-not-a-todo-list

It's not a todo list if I don't say it is!
JavaScript
10
star
15

grafton

Manifold's provider validation tool
Go
9
star
16

service-catalog-tutorial

A step by step introduction to the service-catalog in kubernetes
9
star
17

promptui-demo

Small cli app displaying some manifoldco/promptui features
Go
8
star
18

go-now

Client for Zeit Now deployment API
Go
7
star
19

static-react-demo-app

Demo application to demonstrate how to containerise a static React application
JavaScript
7
star
20

react-scroll-agent

Deadly spy for make benefit glorious nation of Scrolltopia
JavaScript
6
star
21

promulgate

Manifold's release tool
Go
6
star
22

go-signature

Verify signed HTTP requests from Manifold
Go
5
star
23

art

Visual assets and art for the Manifold brand
4
star
24

quickstart

Torus quickstart sample
JavaScript
4
star
25

gql-zero

A lightweight alternative for consuming GraphQL. Zero caching, zero bells. Zero Bloat.
TypeScript
4
star
26

pytill

Python package for Till Mobile
Python
4
star
27

ziggeo-smiledetector

A Smile Detector built with Ziggeo and Manifold
JavaScript
4
star
28

go-manifold

Go client API for Manifold (unstable)
Go
4
star
29

manifold-laravel-demo

Demo Laravel App - Uses Manifold to pull in JawsDB and LogDNA Credenitals
PHP
3
star
30

autotagger

Autotagging for the masses
Go
3
star
31

go-base64

A raw base64 url encoding library for JSON
Go
3
star
32

go-base32

base32 encoding using Manifold's chosen alphabet
Go
2
star
33

aggregate-ml-logs

Machine Learning Observability with Timber.io
Jupyter Notebook
2
star
34

manifold-integration

TypeScript
2
star
35

go-jwt

Convenience wrapper for JWT creation
Go
2
star
36

homebrew-brew

http://brew.sh/ taps for Manifold projects
Ruby
1
star
37

csharp-signature

Verify signed HTTP requests from Manifold
C#
1
star
38

elixir-manifoldco-signature

Verify signed HTTP requests from Manifold in Elixir
Elixir
1
star
39

shadowcat

Manifold OAuth in JS
TypeScript
1
star
40

manifold-init

Manifold UI core package
TypeScript
1
star
41

node-signature

Verify signed HTTP requests from Manifold
JavaScript
1
star
42

protoc-ts

1
star
43

eslint-plugin-stencil

ESLint rules to enforce better practices in Stencil development
JavaScript
1
star
44

manifold-on-zeit

Manifold Marketplace ➡️ ZEIT Marketplace
CSS
1
star
45

go-sample-provider

A minimal provider in Go
Go
1
star
46

mercury

Manifold’s Design Tokens
JavaScript
1
star
47

python-manifoldco-signature

Verify signed HTTP requests from Manifold
Python
1
star
48

node-restify-sample-provider

A minimal provider using Restify
JavaScript
1
star