Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Select ¶
Select displays an interactive command-line menu with a given title and a list of options, allowing the user to choose one of them.
Parameters:
- title: A string that will be displayed as the heading for the menu.
- options: A slice of strings representing the selectable options in the menu.
Returns:
- int: The zero-based index of the option selected by the user in the `options` slice.
- string: The actual string value of the option selected by the user.
- error: An error if the selection process fails or is canceled by the user.
Example usage:
options := []string{"etcd-vm1", "etcd-vm2", "etcd-vm3"}
idx, choice, err := cliui.Select("Please choose one VM:", options)
if err != nil {
fmt.Println("Selection canceled or failed:", err)
return
}
fmt.Printf("You selected option %d: %s\n", idx, choice)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.