Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 842 Bytes

File metadata and controls

42 lines (30 loc) · 842 Bytes

Go Select CLI (goselcli)

Goselcli is a dead simple go library designed to easily build simple CLI's. It's heavily inspired by https://github.com/Nexidian/gocliselect.

Installation

go get github.com/samluiz/goselcli@latest

Usage

Import the menu:
import "github.com/samluiz/goselcli/menu"
Create a new menu:
m := menu.NewMenu("Select an option!")
Add options to the menu:
m.AddOption("Option 1", "1")
m.AddOption("Option 2", "2")
m.AddOption("Option 3", "3")
m.AddOption("Option 4", "4")
m.AddOption("Option 5", "5")
Display the menu and retrieve the choice:
choice := m.Display()

println("You chose:", choice)
Output:
image