Documentation ¶
Overview ¶
The cliutil package contains helper functions specific to the command line interface.
Index ¶
- func AskYesNo(str string, defaultTrue bool) bool
- func CollectNewPassword() string
- func CollectPassword() string
- func ReadString(prompt, deefalt string, hidden bool) string
- func SelectFromList(list []string, prompt string, defaultSelected, requiredResponse bool) []string
- func SplitArguments(args string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskYesNo ¶
Prompt the user for a yes or no question, with a default answer defined by the second argument.
func CollectNewPassword ¶
func CollectNewPassword() string
Ask a command line user to provide a new password, taking the password twice to confirm no errors in typing.
func CollectPassword ¶
func CollectPassword() string
Retrieve a previously defined password from a user.
func ReadString ¶
Read a string from the command line with a prompt. If a "deefalt" string is provided, this will be provided as an option for the user to select automatically. To prevent the user's input from echoing, the hidden argument should be set to true. Users cannot provide an empty string or only whitespace, the prompt will loop until some input is provided.
func SelectFromList ¶
Prompt the user to selection options from a list, passing a list, a promp string, the default state (true = selected) for all members, and a boolean to indicate if at least one selection is required.
func SplitArguments ¶
SplitArguments takes a string of arguments and splits them respecting quoted whitespace
Types ¶
This section is empty.