The Selection Menu gives you multiple options to select from. You can add as many as Go allows!
type SelectionMenu struct {
Title string // The Title
Description string // The Descriptions
Options []string // Options (starts at 1)
Separatorstyle string // Changes the separator between the number and the option title (default: >)
}
How to create:
// You only need the options to make a menu
menu := cmenu.SelectionMenu{
// 1 2 3
Options: []string{"Option 1", "Option 2", "Option 3"},
}
getoption := menu.Show()
Since options start at 1, this is how you would use it in an if statement:
if getoption == 1 {
println("selected option 1")
} else if getoption == 2 {
println("selected option 2")
}