util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskForSudo

func AskForSudo() error

func Exec

func Exec(currentWorkingDir string,
	cmdFmtStr string,
	args ...interface{}) (stdout string, stderr string, exitCode int, err error)

Exec runs a command "sprintf(cmdFmtStr, args)" and return stdout, stderr and exitcode of the command. If exitCode != 0, err will return with a nicely-formatted map of the command's outputs

XXX This command is a simple wrapper around exec.Command(). The following are cases this command does **NOT** accommodate:

  • Using environments in a command
  • Having a field in the command that includes a space as part of the parameter i.e., ./bin -param iPhone 12 # where the input of -param is "iPhone 12", not just "iPhone"

func ExpandPath

func ExpandPath(path string) string

Expand expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is.

func GetProjectBranch

func GetProjectBranch(gitDirectory string) (string, error)

func GetProjectShortHash

func GetProjectShortHash(gitDirectory string) (string, error)

func IsDirectory

func IsDirectory(path string) bool

func IsFile

func IsFile(path string) bool

func SafeDelete added in v1.0.3

func SafeDelete(parentPath, targetPath string) error

func ShallowCloneRepo

func ShallowCloneRepo(projectPath, gitUrl, gitBranch string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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