Documentation ¶
Index ¶
- func Exec(argv0 string, argv []string, envv []string, systemCallExec SystemCallExec) error
- func ExecCommand(context ExecContext, name string, arg ...string) *exec.Cmd
- func FakeExecCommandSuccess(command string, args ...string) *exec.Cmd
- func FakeLookPath(path string) (string, error)
- func FakeSystemCallExecSuccess(argv0 string, argv []string, envv []string) (err error)
- func GeneratePassword(length int) string
- func GetEnvOrDefault(key, defaultVal string) string
- func InitLogger(level string) (logger *zap.Logger, err error)
- func LookPath(file string, context LookPathContext) (string, error)
- func MaxAndMin(data []float64) (max, min float64)
- func Open(url string, browser string, cmdContext ExecContext) error
- func PrintCollectTrend(data []float64) (buf string)
- func URLJoin(host, api string) (targetURL *url.URL, err error)
- func URLJoinAsString(host, api string) (targetURLStr string, err error)
- type ExecContext
- type LookPathContext
- type SystemCallExec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶ added in v0.0.24
func Exec(argv0 string, argv []string, envv []string, systemCallExec SystemCallExec) error
Exec is the wrapper of syscall.Exec
func ExecCommand ¶ added in v0.0.24
func ExecCommand(context ExecContext, name string, arg ...string) *exec.Cmd
ExecCommand is a warp of exec.Command
func FakeExecCommandSuccess ¶ added in v0.0.24
FakeExecCommandSuccess is a function that initialises a new exec.Cmd, one which will simply call TestShellProcessSuccess rather than the command it is provided. It will also pass through the command and its arguments as an argument to TestShellProcessSuccess
func FakeLookPath ¶ added in v0.0.24
FakeLookPath is a fake function of exec.LookPath
func FakeSystemCallExecSuccess ¶ added in v0.0.24
FakeSystemCallExecSuccess is a fake function of syscall.Exec
func GeneratePassword ¶ added in v0.0.18
GeneratePassword generates a password with the specific length
func GetEnvOrDefault ¶ added in v0.0.31
GetEnvOrDefault returns a env or default value
func InitLogger ¶ added in v0.0.23
InitLogger returns a logger
func LookPath ¶ added in v0.0.24
func LookPath(file string, context LookPathContext) (string, error)
LookPath is the wrapper of exec.LookPath
func Open ¶ added in v0.0.24
func Open(url string, browser string, cmdContext ExecContext) error
Open a URL in a browser
func PrintCollectTrend ¶ added in v0.0.21
PrintCollectTrend print the trend of data
func URLJoinAsString ¶ added in v0.0.31
URLJoinAsString is a util function to join host URL and API URL
Types ¶
type ExecContext ¶ added in v0.0.24
ExecContext is the context of system command caller
type LookPathContext ¶ added in v0.0.24
LookPathContext is the context of look path