coreutils

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: Apache-2.0 Imports: 16 Imported by: 35

Documentation

Index

Constants

View Source
const (

	// General core constants
	OnErrorPanic OnError = "panic"

	// Common
	TokenRefreshDisabled        = 0
	TokenRefreshDefaultInterval = 60

	// Home Dir
	JfrogCertsDirName        = "certs"
	JfrogConfigFile          = "jfrog-cli.conf"
	JfrogDependenciesDirName = "dependencies"
	JfrogSecurityDirName     = "security"
	JfrogSecurityConfFile    = "security.yaml"
	JfrogBackupDirName       = "backup"
	JfrogLogsDirName         = "logs"
	JfrogLockDirName         = "lock"
	JfrogPluginsDirName      = "plugins"

	// Env
	ErrorHandling      = "JFROG_CLI_ERROR_HANDLING"
	TempDir            = "JFROG_CLI_TEMP_DIR"
	LogLevel           = "JFROG_CLI_LOG_LEVEL"
	ReportUsage        = "JFROG_CLI_REPORT_USAGE"
	HomeDir            = "JFROG_CLI_HOME_DIR"
	DependenciesDir    = "JFROG_CLI_DEPENDENCIES_DIR"
	BuildName          = "JFROG_CLI_BUILD_NAME"
	BuildNumber        = "JFROG_CLI_BUILD_NUMBER"
	Project            = "JFROG_CLI_BUILD_PROJECT"
	TransitiveDownload = "JFROG_CLI_TRANSITIVE_DOWNLOAD_EXPERIMENTAL"
	CI                 = "CI"
	// Deprecated:
	JfrogHomeEnv = "JFROG_CLI_HOME"
)

Variables

View Source
var ExitCodeError = ExitCode{1}
View Source
var ExitCodeFailNoOp = ExitCode{2}
View Source
var ExitCodeNoError = ExitCode{0}
View Source
var ExitCodeVulnerableBuild = ExitCode{3}

Functions

func AskYesNo

func AskYesNo(promptPrefix string, defaultValue bool) bool

Ask a yes or no question, with a default answer.

func CreateDirInJfrogHome

func CreateDirInJfrogHome(dirName string) (string, error)

func ExitOnErr

func ExitOnErr(err error)

func ExtractInsecureTlsFromArgs added in v1.5.0

func ExtractInsecureTlsFromArgs(args []string) (cleanArgs []string, insecureTls bool, err error)

func FindBooleanFlag added in v1.5.0

func FindBooleanFlag(flagName string, args []string) (flagIndex int, flagValue bool, err error)

Boolean flag can be provided in one of the following forms: 1. --flag=value, where value can be true/false 2. --flag, here the value is true Return values: flagIndex - index of flagName in args. flagValue - value of flagName. err - error if flag exists, but we failed to extract its value. If flag does not exist flagIndex = -1 with false value and nil error.

func FindFlag added in v1.5.0

func FindFlag(flagName string, args []string) (flagIndex, flagValueIndex int, flagValue string, err error)

Find value of required CLI flag in Command. If flag does not exist, the returned index is -1 and nil is returned as the error. Return values: err - error if flag exists but failed to extract its value. flagIndex - index of flagName in Command. flagValueIndex - index in Command in which the value of the flag exists. flagValue - value of flagName.

func FindFlagFirstMatch added in v1.5.0

func FindFlagFirstMatch(flags, args []string) (flagIndex, flagValueIndex int, flagValue string, err error)

Find the first match of any of the provided flags in args. Return same values as FindFlag.

func GetCliPersistentTempDirPath

func GetCliPersistentTempDirPath() string

Return the path of CLI temp dir. This path should be persistent, meaning - should not be cleared at the end of a CLI run.

func GetCliUserAgent

func GetCliUserAgent() string

func GetCliUserAgentName added in v1.6.0

func GetCliUserAgentName() string

func GetCliUserAgentVersion added in v1.6.0

func GetCliUserAgentVersion() string

func GetClientAgentName added in v1.6.0

func GetClientAgentName() string

func GetClientAgentVersion added in v1.6.0

func GetClientAgentVersion() string

func GetConfigVersion

func GetConfigVersion() int

func GetJfrogBackupDir

func GetJfrogBackupDir() (string, error)

func GetJfrogCertsDir

func GetJfrogCertsDir() (string, error)

func GetJfrogHomeDir

func GetJfrogHomeDir() (string, error)

func GetJfrogPluginsDir

func GetJfrogPluginsDir() (string, error)

func GetJfrogSecurityConfFilePath

func GetJfrogSecurityConfFilePath() (string, error)

func GetJfrogSecurityDir

func GetJfrogSecurityDir() (string, error)

func IsAnyEmpty added in v1.4.0

func IsAnyEmpty(strings ...string) bool

func IsLinux

func IsLinux() bool

func IsWindows

func IsWindows() bool

func PanicOnError

func PanicOnError(err error) error

func ParseArgs added in v1.5.0

func ParseArgs(args []string) ([]string, error)

Iterate over each argument, if env variable is found (e.g $HOME) replace it with env value.

func RemoveFlagFromCommand added in v1.5.0

func RemoveFlagFromCommand(args *[]string, flagIndex, flagValueIndex int)

Removes the provided flag and value from the command arguments

func ReplaceVars

func ReplaceVars(content []byte, specVars map[string]string) []byte

func SetCliUserAgentName added in v1.6.0

func SetCliUserAgentName(cliUserAgentNameToSet string)

func SetCliUserAgentVersion added in v1.6.0

func SetCliUserAgentVersion(versionToSet string)

func SetClientAgentName added in v1.6.0

func SetClientAgentName(clientAgentToSet string)

func SetClientAgentVersion added in v1.6.0

func SetClientAgentVersion(versionToSet string)

func SetIfEmpty added in v1.4.0

func SetIfEmpty(str *string, defaultStr string) bool

func SpecVarsStringToMap

func SpecVarsStringToMap(rawVars string) map[string]string

func StringsSliceContains added in v1.7.0

func StringsSliceContains(slice []string, str string) bool

func SumTrueValues

func SumTrueValues(boolArr []bool) int

Types

type CliError

type CliError struct {
	ExitCode
	ErrorMsg string
}

func (CliError) Error

func (err CliError) Error() string

type Credentials

type Credentials interface {
	SetUser(string)
	SetPassword(string)
	GetUser() string
	GetPassword() string
}

type ExitCode

type ExitCode struct {
	Code int
}

Exit codes:

func GetExitCode

func GetExitCode(err error, success, failed int, failNoOp bool) ExitCode

type OnError

type OnError string

Error modes (how should the application behave when the CheckError function is invoked):

Jump to

Keyboard shortcuts

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