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 ¶
func Exec(argv0 string, argv []string, envv []string, systemCallExec SystemCallExec) error
Exec is the wrapper of syscall.Exec
func ExecCommand ¶
func ExecCommand(context ExecContext, name string, arg ...string) *exec.Cmd
ExecCommand is a warp of exec.Command
func FakeExecCommandSuccess ¶
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 ¶
FakeLookPath is a fake function of exec.LookPath
func FakeSystemCallExecSuccess ¶
FakeSystemCallExecSuccess is a fake function of syscall.Exec
func GeneratePassword ¶
GeneratePassword generates a password with the specific length
func GetEnvOrDefault ¶
GetEnvOrDefault returns a env or default value
func InitLogger ¶
InitLogger returns a logger
func LookPath ¶
func LookPath(file string, context LookPathContext) (string, error)
LookPath is the wrapper of exec.LookPath
func Open ¶
func Open(url string, browser string, cmdContext ExecContext) error
Open a URL in a browser
func PrintCollectTrend ¶
PrintCollectTrend print the trend of data
func URLJoinAsString ¶
URLJoinAsString is an util function to join host URL and API URL
Types ¶
type ExecContext ¶
ExecContext is the context of system command caller
type LookPathContext ¶
LookPathContext is the context of look path