Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/afeiship/go-ipt

Interactive Pipe To: The golang cli interactive workflow.
https://github.com/afeiship/go-ipt

cli golang interactive ipt pipe

Last synced: 28 days ago
JSON representation

Interactive Pipe To: The golang cli interactive workflow.

Awesome Lists containing this project

README

        




ipt logo


# go-ipt
> Interactive Pipe To: The golang cli interactive workflow.

## installation
```sh
go get -u github.com/afeiship/go-ipt
```

## usage
```go
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)
}
```