Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Choice ¶
func Choice(choices []ChoiceStruct) string
**SINGLE CHOICE**
let the user select one choice with the arrow keys confirm with enter
Returns the id of the selected choice as a string ¶
Example: selected := Choice(
[]ChoiceStruct{
{
choice: "Choice 1",
id: "1",
},
{
choice: "Choice 2",
id: "2",
},
{
choice: "Choice 3",
id: "3",
},
},
)
fmt.Println(selected) // ["1"]
func MultipleChoice ¶
func MultipleChoice(choices []MultipleChoiceStruct, forceResult bool) []string
**MULTIPLE CHOICE**
lets the user select multiple choices with the spacebar confirm with enter
Returns a slice of the selected choices Example: selected := Choice(
[]ChoiceStruct{
{
choice: "Choice 1",
id: "1",
},
{
choice: "Choice 2",
id: "2",
},
{
choice: "Choice 3",
id: "3",
},
},
// forceResult
// if true, the user has to select at least one choice, otherwise it won't return
false,
)
fmt.Println(selected) // ["1", "3"]
Types ¶
type ChoiceStruct ¶
type MultipleChoiceStruct ¶
Click to show internal directories.
Click to hide internal directories.