jenkins-cli: Index | Files

package util

import ""


Package Files

cmd.go collect.go env.go logger.go password.go url.go

func Exec Uses

func Exec(argv0 string, argv []string, envv []string, systemCallExec SystemCallExec) error

Exec is the wrapper of syscall.Exec

func ExecCommand Uses

func ExecCommand(context ExecContext, name string, arg ...string) *exec.Cmd

ExecCommand is a warp of exec.Command

func FakeExecCommandSuccess Uses

func FakeExecCommandSuccess(command string, args ...string) *exec.Cmd

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 Uses

func FakeLookPath(path string) (string, error)

FakeLookPath is a fake function of exec.LookPath

func FakeSystemCallExecSuccess Uses

func FakeSystemCallExecSuccess(argv0 string, argv []string, envv []string) (err error)

FakeSystemCallExecSuccess is a fake function of syscall.Exec

func GeneratePassword Uses

func GeneratePassword(length int) string

GeneratePassword generates a password with the specific length

func GetEnvOrDefault Uses

func GetEnvOrDefault(key, defaultVal string) string

GetEnvOrDefault returns a env or default value

func InitLogger Uses

func InitLogger(level string) (logger *zap.Logger, err error)

InitLogger returns a logger

func LookPath Uses

func LookPath(file string, context LookPathContext) (string, error)

LookPath is the wrapper of exec.LookPath

func MaxAndMin Uses

func MaxAndMin(data []float64) (max, min float64)

MaxAndMin return the max and min number

func Open Uses

func Open(url string, browser string, cmdContext ExecContext) error

Open a URL in a browser

func PrintCollectTrend Uses

func PrintCollectTrend(data []float64) (buf string)

PrintCollectTrend print the trend of data

func URLJoin Uses

func URLJoin(host, api string) (targetURL *url.URL, err error)

URLJoin is a util function to join host URL and API URL

func URLJoinAsString Uses

func URLJoinAsString(host, api string) (targetURLStr string, err error)

URLJoinAsString is a util function to join host URL and API URL

type ExecContext Uses

type ExecContext = func(name string, arg ...string) *exec.Cmd

ExecContext is the context of system command caller

type LookPathContext Uses

type LookPathContext = func(file string) (string, error)

LookPathContext is the context of look path

type SystemCallExec Uses

type SystemCallExec = func(argv0 string, argv []string, envv []string) (err error)

SystemCallExec is the context of syscall.Exec

Package util imports 12 packages (graph) and is imported by 5 packages. Updated 2021-01-27. Refresh now. Tools for package owners.