cliutil

package
v0.0.0-...-a56da61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

The cliutil package contains helper functions specific to the command line interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskYesNo

func AskYesNo(str string, defaultTrue bool) bool

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

func ReadString(prompt, deefalt string, hidden bool) string

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

func SelectFromList(list []string, prompt string, defaultSelected, requiredResponse bool) []string

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

func SplitArguments(args string) []string

SplitArguments takes a string of arguments and splits them respecting quoted whitespace

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL