Documentation ¶
Index ¶
- Variables
- func CommandInstalled(command string) bool
- func CommandInstalledE(command string) error
- func FPromptUserForInput(out io.Writer, in io.Reader, prompt string, options *ShellOptions) (string, error)
- func FPromptUserForYesNo(out io.Writer, in io.Reader, prompt string, options *ShellOptions) (bool, error)
- func PromptUserForInput(prompt string, options *ShellOptions) (string, error)
- func PromptUserForPassword(prompt string, options *ShellOptions) (string, error)
- func PromptUserForYesNo(prompt string, options *ShellOptions) (bool, error)
- func RunShellCommand(options *ShellOptions, command string, args ...string) error
- func RunShellCommandAndGetAndStreamOutput(options *ShellOptions, command string, args ...string) (string, error)
- func RunShellCommandAndGetOutput(options *ShellOptions, command string, args ...string) (string, error)
- func RunShellCommandAndGetStdout(options *ShellOptions, command string, args ...string) (string, error)
- func RunShellCommandAndGetStdoutAndStreamOutput(options *ShellOptions, command string, args ...string) (string, error)
- type ShellOptions
Constants ¶
This section is empty.
Variables ¶
var NonInteractivePasswordPrompt = fmt.Errorf("The non-interactive flag is set, so unable to prompt user for a password.")
Functions ¶
func CommandInstalled ¶
Return true if the OS has the given command installed
func CommandInstalledE ¶
CommandInstalledE returns an error if command is not installed
func FPromptUserForInput ¶
func FPromptUserForYesNo ¶
func PromptUserForInput ¶
func PromptUserForInput(prompt string, options *ShellOptions) (string, error)
Prompt the user for text in the CLI. Returns the text entered by the user.
func PromptUserForPassword ¶
func PromptUserForPassword(prompt string, options *ShellOptions) (string, error)
Prompt a user for a password or other sensitive info that should not be echoed back to stdout.
func PromptUserForYesNo ¶
func PromptUserForYesNo(prompt string, options *ShellOptions) (bool, error)
Prompt the user for a yes/no response and return true if they entered yes.
func RunShellCommand ¶
func RunShellCommand(options *ShellOptions, command string, args ...string) error
Run the specified shell command with the specified arguments. Connect the command's stdin, stdout, and stderr to the currently running app.
func RunShellCommandAndGetAndStreamOutput ¶
func RunShellCommandAndGetAndStreamOutput(options *ShellOptions, command string, args ...string) (string, error)
Run the specified shell command with the specified arguments. Return its stdout and stderr as a string and also stream stdout and stderr to the OS stdout/stderr
func RunShellCommandAndGetOutput ¶
func RunShellCommandAndGetOutput(options *ShellOptions, command string, args ...string) (string, error)
Run the specified shell command with the specified arguments. Return its stdout and stderr as a string
func RunShellCommandAndGetStdout ¶ added in v0.7.2
func RunShellCommandAndGetStdout(options *ShellOptions, command string, args ...string) (string, error)
Run the specified shell command with the specified arguments. Return its stdout as a string
func RunShellCommandAndGetStdoutAndStreamOutput ¶ added in v0.7.2
func RunShellCommandAndGetStdoutAndStreamOutput(options *ShellOptions, command string, args ...string) (string, error)
Run the specified shell command with the specified arguments. Return its stdout as a string and also stream stdout and stderr to the OS stdout/stderr
Types ¶
type ShellOptions ¶
type ShellOptions struct { NonInteractive bool Logger *logrus.Logger WorkingDir string SensitiveArgs bool // If true, will not log the arguments to the command Env map[string]string // Additional environment variables to set }
func NewShellOptions ¶
func NewShellOptions() *ShellOptions