Interactive Pipe To: The golang cli interactive workflow.
go get -u github.com/afeiship/go-ipt
package main
import (
"github.com/afeiship/go-ipt"
)
func main() {
type ColorObj struct {
Name string
Hex string
}
opts := []ipt.Option[ColorObj]{
{Label: "Red", Value: ColorObj{"Red", "#FF0000"}},
{Label: "Green", Value: ColorObj{"Green", "#00FF00"}},
{Label: "Blue", Value: ColorObj{"Blue", "#0000FF"}},
}
color, err := ipt.Ipt("What is your favorite color?", opts)
if err != nil {
panic(err)
}
println(color.Name, color.Hex)
}