Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.24 KB

README.md

File metadata and controls

47 lines (35 loc) · 1.24 KB

prompt

GoDoc CI

Ascetic and minimalistic CLI prompt library.

This is yet another CLI prompt library in Go. Its main purpose is to provide as simple as possible API for both users of the library and users of the program using this library.

Usage

// Simple line reading.
name, _ := prompt.ReadLine(ctx, "What's your name? ")

// Y/n confirmation.
yes, _ := prompt.Confirm(context.TODO(), name+", do you want to continue?")
if !yes {
	return
}

// Menu with single possible answer.
x, _ := prompt.SelectSingle(ctx, 
	"Which football club is your favorite?", 
	[]string{
		"FC Barcelona",
		"Spartak Moscow",
		"Manchester United",
		"Juventus",
	},
)

For more details please visit example folder.

Screencast

This screencast was recorded by running binary from example folder.