Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markelog/list
Terminal interactive list
https://github.com/markelog/list
cli console go golang interactive list terminal view
Last synced: about 1 month ago
JSON representation
Terminal interactive list
- Host: GitHub
- URL: https://github.com/markelog/list
- Owner: markelog
- License: mit
- Created: 2016-08-11T03:08:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-09-28T13:55:41.000Z (over 1 year ago)
- Last Synced: 2024-04-14T18:36:30.453Z (9 months ago)
- Topics: cli, console, go, golang, interactive, list, terminal, view
- Language: Go
- Size: 88.9 KB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# List [![Build Status](https://travis-ci.org/markelog/list.svg)](https://travis-ci.org/markelog/list) [![GoDoc](https://godoc.org/github.com/markelog/list?status.svg)](https://godoc.org/github.com/markelog/list) [![Go Report Card](https://goreportcard.com/badge/github.com/markelog/list)](https://goreportcard.com/report/github.com/markelog/list)
> Terminal interactive list
This
```go
options := []string{"Gangsta panda", "Sexy turtle", "Killa gorilla",}// returns user choice i.e. "Gangsta panda"
list.GetWith("Which animal is the coolest?", options)
```Will get you
![](./example.gif)
## A bit of flexibility
```go
package mainimport (
"fmt""github.com/fatih/color"
"github.com/markelog/list"
)options := []string{"Gangsta panda", "Sexy turtle", "Killa gorilla",}
l := list.New("Which animal is the coolest?", options)
// Set your own printer
l.SetPrint(func(args ...interface{}) (n int, err error) {
return fmt.Print(args...)
})// Set your own colors
// With github.com/fatih/color package
l.SetColors(&list.Colors{
Head: color.New(color.BgRed),
Option: color.New(color.FgGreen, color.Underline),
Highlight: color.New(color.FgCyan, color.Bold),
})// Show the list
l.Show()// Waiting for the user input
l.Get()
```