Documentation ¶
Index ¶
- func BashStringCmd(cmdStr string) string
- func BashStringSplitOutput(cmdStr string) (string, error)
- func BufferInsert(buffer bytes.Buffer, target string, content string) bytes.Buffer
- func CheckCmd(p string) bool
- func CheckCmdHard(p string) string
- func CheckSudo() error
- func CommandSubSplitOutput(name string, args ...string) (string, error)
- func CommandSubSplitOutputContext(directory, name string, args ...string) (string, error)
- func CommandSubstitution(name string, args ...string) string
- func CommandSubstitutionExitCode(name string, args ...string) (exitCode int)
- func ConfirmationPrompt(prompt string, weighting string) bool
- func DebugCmd(cmd string)
- func DebugErrOutput(output error)
- func DebugOutput(output []byte)
- func DebugString(output string)
- func DownloadFile(filepath string, url string) error
- func GainSudo()
- func RandomString() (string, error)
- func ReadStdin(prompt string) string
- func StdinPrompt(prompt string) string
- func StdoutCmd(name string, args ...string) string
- func StdoutStreamCmd(name string, args ...string)
- func StdoutStreamCmdDebug(name string, args ...string)
- func StdoutStreamCmdDebugContext(directory, name string, args ...string)
- func StreamOSCmd(name string, args ...string)
- func StreamOSCmdContext(directory, name string, args ...string)
- func StringSliceContains(s []string, e string) bool
- func Timestamp() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BashStringCmd ¶
BashStringCmd - Execute a bash command from a string `bash -c "(cmd)" with no log output`
func BashStringSplitOutput ¶
BashStringSplitOutput - Execute a bash command splitting the resulting stdout and stderr
func BufferInsert ¶
BufferInsert - Insert content into a buffer at a target string
func CheckSudo ¶
func CheckSudo() error
CheckSudo - Check if a user has permissions to run sudo It's up to the calling function to prime the user to input their password, and to present an error and next-steps in the event that sudo access fails
func CommandSubSplitOutput ¶
CommandSubSplitOutput - Execute a command and return the output value split into stdout and stderr. No exit on stdErr
func CommandSubSplitOutputContext ¶
CommandSubSplitOutputContext - Execute a command and return the output value split into stdout and stderr from a directory context. No exit on stdErr
func CommandSubstitution ¶
CommandSubstitution - Execute a command and return the output value. No exit on stdErr
func CommandSubstitutionExitCode ¶
CommandSubstitutionExitCode - Execute a command and return 0 if successful, or 1 if failed We can't return the true exit code on MacOS as this isn't a reliable method and will have if `name` is not available in the users' path (see: https://stackoverflow.com/questions/10385551/get-exit-code-go)
func ConfirmationPrompt ¶
ConfirmationPrompt - The 'weighting' param should be one of [ "y", "n" ].
func DownloadFile ¶
DownloadFile - download a url to a local file.
func GainSudo ¶
func GainSudo()
GainSudo - use `sudo true` to gain sudo privileges. Used if the user needs to specify a password to gain sudo, otherwise not necessary.
func StdoutStreamCmd ¶
StdoutStreamCmd - Execute a command on the users' OS and stream stdout
func StdoutStreamCmdDebug ¶
StdoutStreamCmdDebug - Execute a command on the users' OS and stream stdout for debug only
func StdoutStreamCmdDebugContext ¶
StdoutStreamCmdDebugContext - Execute a command on the users' OS and stream stdout for debug only
func StreamOSCmd ¶
StreamOSCmd - Execute a command outputting OS stdout/stdin/stderr directly to the console
func StreamOSCmdContext ¶
StreamOSCmdContext - Execute a command outputting OS stdout/stdin/stderr directly to the console from context
func StringSliceContains ¶
Types ¶
This section is empty.