beats: Index | Files

package cli

import ""


Package Files

cli.go confirm.go password.go

func Confirm Uses

func Confirm(prompt string, def bool) (bool, error)

Confirm shows the confirmation text and ask the user to answer (y/n) default will be shown in uppercase and be selected if the user hits enter returns true for yes, false for no

func GetEnvOr Uses

func GetEnvOr(name, def string) string

GetEnvOr return the value of the environment variable if the value is set, if its not set it will return the default value.

Note: if the value is set but it is an empty string we will return the empty string.

func ReadPassword Uses

func ReadPassword(def string) (string, error)

ReadPassword allows to read a password passed as a command line parameter. It offers several ways to read the password so it is not directly passed as a plain text argument:

stdin - Will prompt the user to input the password
env:VAR_NAME - Will read the password from the given env variable

func RunWith Uses

func RunWith(
    fn func(cmd *cobra.Command, args []string) error,
) func(cmd *cobra.Command, args []string)

RunWith wrap cli function with an error handler instead of having the code exit early.

Package cli imports 10 packages (graph) and is imported by 74 packages. Updated 2019-05-25. Refresh now. Tools for package owners.