Documentation ¶
Index ¶
- Constants
- Variables
- func AskYesNo(promptPrefix string, defaultValue bool) bool
- func ChmodPluginsDirectoryContent() error
- func ContainsApplicabilityScannableTech(technologies []Technology) bool
- func ConvertExitCodeError(err error) error
- func CreateDirInJfrogHome(dirName string) (string, error)
- func DetectTechnologies(path string, isCiSetup, recursive bool) (map[Technology]bool, error)
- func DetectedTechnologiesList() (technologies []string)
- func DetectedTechnologiesToSlice(detected map[Technology]bool) []string
- func ExitOnErr(err error)
- func ExtractDetailedSummaryFromArgs(args []string) (cleanArgs []string, detailedSummary bool, err error)
- func ExtractFailFromArgs(args []string) (cleanArgs []string, fail bool, err error)
- func ExtractInsecureTlsFromArgs(args []string) (cleanArgs []string, insecureTls bool, err error)
- func ExtractLicensesFromArgs(args []string) (cleanArgs []string, licenses bool, err error)
- func ExtractRepoPathFromArgs(args []string) (cleanArgs []string, repoPath string, err error)
- func ExtractServerIdFromCommand(args []string) (cleanArgs []string, serverId string, err error)
- func ExtractSkipLoginFromArgs(args []string) (cleanArgs []string, skipLogin bool, err error)
- func ExtractThreadsFromArgs(args []string, defaultValue int) (cleanArgs []string, threads int, err error)
- func ExtractWatchesFromArgs(args []string) (cleanArgs []string, watches string, err error)
- func ExtractXrayOutputFormatFromArgs(args []string) (cleanArgs []string, format string, err error)
- func ExtractXrayScanFromArgs(args []string) (cleanArgs []string, xrayScan bool, err error)
- func FindBooleanFlag(flagName string, args []string) (flagIndex int, flagValue bool, err error)
- func FindFlag(flagName string, args []string) (flagIndex, flagValueIndex int, flagValue string, err error)
- func FindFlagFirstMatch(flags, args []string) (flagIndex, flagValueIndex int, flagValue string, err error)
- func GetCliConfigVersion() int
- func GetCliExecutableName() string
- func GetCliPersistentTempDirPath() string
- func GetCliUserAgent() string
- func GetCliUserAgentName() string
- func GetCliUserAgentVersion() string
- func GetClientAgentName() string
- func GetClientAgentVersion() string
- func GetFullPathsWorkingDirs(workingDirs []string) ([]string, error)
- func GetJfrogBackupDir() (string, error)
- func GetJfrogCertsDir() (string, error)
- func GetJfrogConfigLockDir() (string, error)
- func GetJfrogHomeDir() (string, error)
- func GetJfrogLocksDir() (string, error)
- func GetJfrogPluginsDir() (string, error)
- func GetJfrogPluginsLockDir() (string, error)
- func GetJfrogPluginsResourcesDir(pluginsName string) (string, error)
- func GetJfrogSecurityConfFilePath() (string, error)
- func GetJfrogSecurityDir() (string, error)
- func GetJfrogTransferDir() (string, error)
- func GetJfrogTransferLockDir() (string, error)
- func GetJfrogTransferRepositoriesDir() (string, error)
- func GetJfrogTransferRunStatusFilePath() (string, error)
- func GetMaskedCommandString(cmd *exec.Cmd) string
- func GetOSAndArc() (string, error)
- func GetPluginsConfigVersion() int
- func GetPluginsDirContent() ([]os.DirEntry, error)
- func GetServerIdAndRepo(remoteEnv string) (serverID string, repoName string, err error)
- func GetWorkingDirectory() (string, error)
- func IsAnyEmpty(strings ...string) bool
- func IsLinux() bool
- func IsMac() bool
- func IsWindows() bool
- func ListToText(list []string) string
- func PanicOnError(err error) error
- func PrepareTable(rows interface{}, emptyTableMessage string, printExtended bool) (table.Writer, error)
- func PrintBold(str string) string
- func PrintBoldTitle(str string) string
- func PrintComment(str string) string
- func PrintLink(str string) string
- func PrintMessage(message string)
- func PrintTable(rows interface{}, title string, emptyTableMessage string, printExtended bool) (err error)
- func PrintTitle(str string) string
- func PrintYellow(str string) string
- func RemoveAllWhiteSpaces(input string) string
- func RemoveEmojisIfNonSupportedTerminal(msg string) string
- func RemoveFlagFromCommand(args *[]string, flagIndex, flagValueIndex int)
- func ReplaceVars(content []byte, specVars map[string]string) []byte
- func SetCliExecutableName(executableName string)
- func SetCliUserAgentName(cliUserAgentNameToSet string)
- func SetCliUserAgentVersion(versionToSet string)
- func SetClientAgentName(clientAgentToSet string)
- func SetClientAgentVersion(versionToSet string)
- func SetIfEmpty(str *string, defaultStr string) bool
- func SetPermissionsRecursively(dirPath string, mode os.FileMode) error
- func SpecVarsStringToMap(rawVars string) map[string]string
- func SumTrueValues(boolArr []bool) int
- type CliError
- type Credentials
- type ExitCode
- type GeneralExecCmd
- type OnError
- type TechData
- type Technology
- func (tech Technology) ApplicabilityScannable() bool
- func (tech Technology) GetExecCommandName() string
- func (tech Technology) GetPackageDescriptor() string
- func (tech Technology) GetPackageInstallationCommand() string
- func (tech Technology) GetPackageType() string
- func (tech Technology) GetPackageVersionOperator() string
- func (tech Technology) IsCiSetup() bool
- func (tech Technology) ToFormal() string
- func (tech Technology) ToString() string
Constants ¶
const ( // General core constants OnErrorPanic OnError = "panic" // Common TokenRefreshDisabled = 0 TokenRefreshDefaultInterval = 60 // Home Dir JfrogBackupDirName = "backup" JfrogCertsDirName = "certs" JfrogConfigFile = "jfrog-cli.conf" JfrogDependenciesDirName = "dependencies" JfrogLocksDirName = "locks" JfrogLogsDirName = "logs" JfrogPluginsDirName = "plugins" JfrogPluginsFileName = "plugins.yml" JfrogSecurityConfFile = "security.yaml" JfrogSecurityDirName = "security" JfrogTransferDelaysDirName = "delays" JfrogTransferDirName = "transfer" JfrogTransferErrorsDirName = "errors" JfrogTransferRepoSnapshotFileName = "repo-snapshot.json" JfrogTransferRepoStateFileName = "repo-state.json" JfrogTransferRepositoriesDirName = "repositories" JfrogTransferRetryableErrorsDirName = "retryable" JfrogTransferRunStatusFileName = "run-status.json" JfrogTransferSkippedErrorsDirName = "skipped" JfrogTransferSnapshotDirName = "snapshot" JfrogTransferStateFileName = "state.json" PluginsExecDirName = "bin" PluginsResourcesDirName = "resources" //#nosec G101 ErrorHandling = "JFROG_CLI_ERROR_HANDLING" TempDir = "JFROG_CLI_TEMP_DIR" LogLevel = "JFROG_CLI_LOG_LEVEL" LogTimestamp = "JFROG_CLI_LOG_TIMESTAMP" ReportUsage = "JFROG_CLI_REPORT_USAGE" DependenciesDir = "JFROG_CLI_DEPENDENCIES_DIR" TransitiveDownload = "JFROG_CLI_TRANSITIVE_DOWNLOAD_EXPERIMENTAL" FailNoOp = "JFROG_CLI_FAIL_NO_OP" CI = "CI" ServerID = "JFROG_CLI_SERVER_ID" )
const ( GettingStartedGuideUrl = "https://github.com/jfrog/jfrog-cli/blob/v2/guides/getting-started-with-jfrog-using-the-cli.md" JFrogComUrl = "https://jfrog.com/" JFrogHelpUrl = JFrogComUrl + "help/r/" )
const ( // ReleasesRemoteEnv should be used for downloading the CLI dependencies (extractor jars, analyzerManager etc.) through an Artifactory remote // repository, instead of downloading directly from releases.jfrog.io. The remote repository should be // configured to proxy releases.jfrog.io. // This env var should store a server ID and a remote repository in form of '<ServerID>/<RemoteRepo>' ReleasesRemoteEnv = "JFROG_CLI_RELEASES_REPO" // DeprecatedExtractorsRemoteEnv is deprecated, it is replaced with ReleasesRemoteEnv. // Its functionality was similar to ReleasesRemoteEnv, but it proxies releases.jfrog.io/artifactory/oss-release-local instead. DeprecatedExtractorsRemoteEnv = "JFROG_CLI_EXTRACTORS_REMOTE" // JFrog releases URL JfrogReleasesUrl = "https://releases.jfrog.io/artifactory/" )
const Pypi = "pypi"
Variables ¶
var ( HomeDir = "JFROG_CLI_HOME_DIR" BuildName = "JFROG_CLI_BUILD_NAME" BuildNumber = "JFROG_CLI_BUILD_NUMBER" Project = "JFROG_CLI_BUILD_PROJECT" //#nosec G101 EncryptionKey = "JFROG_CLI_ENCRYPTION_KEY" )
Although these vars are constant, they are defined inside a vars section and not a constants section because the tests modify these values.
var DefaultMaxColWidth = 25
Controls the max col width when printing to a non-terminal. See the PrintTable description for more info.
var ExitCodeError = ExitCode{1}
var ExitCodeFailNoOp = ExitCode{2}
var ExitCodeNoError = ExitCode{0}
var ExitCodeVulnerableBuild = ExitCode{3}
Functions ¶
func ChmodPluginsDirectoryContent ¶ added in v2.13.0
func ChmodPluginsDirectoryContent() error
func ContainsApplicabilityScannableTech ¶ added in v2.39.3
func ContainsApplicabilityScannableTech(technologies []Technology) bool
func ConvertExitCodeError ¶ added in v2.1.0
When running a command in an external process, if the command fails to run or doesn't complete successfully ExitError is returned. We would like to return a regular error instead of ExitError, because some frameworks (such as codegangsta used by JFrog CLI) automatically exit when this error is returned.
func CreateDirInJfrogHome ¶
func DetectTechnologies ¶ added in v2.7.0
func DetectTechnologies(path string, isCiSetup, recursive bool) (map[Technology]bool, error)
DetectTechnologies tries to detect all technologies types according to the files in the given path. 'isCiSetup' will limit the search of possible techs to Maven, Gradle, and npm. 'recursive' will determine if the search will be limited to files in the root path or not.
func DetectedTechnologiesList ¶ added in v2.41.5
func DetectedTechnologiesList() (technologies []string)
func DetectedTechnologiesToSlice ¶ added in v2.12.0
func DetectedTechnologiesToSlice(detected map[Technology]bool) []string
DetectedTechnologiesToSlice returns a string slice that includes all the names of the detected technologies.
func ExtractFailFromArgs ¶ added in v2.10.0
Used by docker
func ExtractLicensesFromArgs ¶ added in v2.10.0
Used by docker scan (Xray)
func ExtractRepoPathFromArgs ¶ added in v2.10.0
Used by docker scan (Xray)
func ExtractServerIdFromCommand ¶ added in v2.10.0
func ExtractSkipLoginFromArgs ¶ added in v2.10.0
Used by docker
func ExtractThreadsFromArgs ¶ added in v2.10.0
func ExtractWatchesFromArgs ¶ added in v2.10.0
Used by docker scan (Xray)
func ExtractXrayOutputFormatFromArgs ¶ added in v2.4.1
func ExtractXrayScanFromArgs ¶
func FindBooleanFlag ¶
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 ¶
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 ¶
func FindFlagFirstMatch(flags, args []string) (flagIndex, flagValueIndex int, flagValue string, err error)
Find the first match of the provided flags in args. Return same values as FindFlag.
func GetCliConfigVersion ¶ added in v2.13.0
func GetCliConfigVersion() int
GetCliConfigVersion returns the latest version of the config.yml file on the file system at '.jfrog'.
func GetCliExecutableName ¶ added in v2.5.0
func GetCliExecutableName() string
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 ¶
func GetCliUserAgentName() string
func GetCliUserAgentVersion ¶
func GetCliUserAgentVersion() string
func GetClientAgentName ¶
func GetClientAgentName() string
func GetClientAgentVersion ¶
func GetClientAgentVersion() string
func GetFullPathsWorkingDirs ¶ added in v2.41.5
Receives a list of relative path working dirs, returns a list of full paths working dirs
func GetJfrogBackupDir ¶
func GetJfrogCertsDir ¶
func GetJfrogConfigLockDir ¶ added in v2.2.0
func GetJfrogHomeDir ¶
func GetJfrogLocksDir ¶ added in v2.2.0
func GetJfrogPluginsDir ¶
func GetJfrogPluginsLockDir ¶ added in v2.13.0
func GetJfrogPluginsResourcesDir ¶ added in v2.13.0
func GetJfrogSecurityDir ¶
func GetJfrogTransferDir ¶ added in v2.17.0
func GetJfrogTransferLockDir ¶ added in v2.23.0
func GetJfrogTransferRepositoriesDir ¶ added in v2.25.0
func GetJfrogTransferRunStatusFilePath ¶ added in v2.23.0
func GetMaskedCommandString ¶ added in v2.41.5
func GetOSAndArc ¶ added in v2.34.1
func GetPluginsConfigVersion ¶ added in v2.13.0
func GetPluginsConfigVersion() int
GetPluginsConfigVersion returns the latest plugins layout version on the file system (at '.jfrog/plugins').
func GetPluginsDirContent ¶ added in v2.13.0
func GetServerIdAndRepo ¶ added in v2.32.0
func GetWorkingDirectory ¶
func IsAnyEmpty ¶
func ListToText ¶ added in v2.11.3
Turn a list of strings into a sentence. For example, turn ["one", "two", "three"] into "one, two and three". For a single element: "one".
func PanicOnError ¶
func PrepareTable ¶ added in v2.11.3
func PrepareTable(rows interface{}, emptyTableMessage string, printExtended bool) (table.Writer, error)
Creates table following the logic described in PrintTable. Returns: Table Writer (table.Writer) - Can be used to adjust style, output mirror, render type, etc. Error if occurred.
func PrintBoldTitle ¶ added in v2.28.0
Add bold and green style to the string if possible.
func PrintComment ¶ added in v2.7.2
Add gray color style to the string if possible.
func PrintMessage ¶ added in v2.1.0
func PrintMessage(message string)
PrintMessage prints message in a frame (which is actually a table with a single table). For example: ┌─────────────────────────────────────────┐ │ An example of a message in a nice frame │ └─────────────────────────────────────────┘
func PrintTable ¶ added in v2.1.0
func PrintTitle ¶ added in v2.7.2
Add green color style to the string if possible.
func PrintYellow ¶ added in v2.41.1
Add yellow color style to the string if possible.
func RemoveAllWhiteSpaces ¶ added in v2.11.3
func RemoveEmojisIfNonSupportedTerminal ¶ added in v2.20.0
Remove emojis from non-supported terminals
func RemoveFlagFromCommand ¶
Removes the provided flag and value from the command arguments
func SetCliExecutableName ¶ added in v2.5.0
func SetCliExecutableName(executableName string)
func SetCliUserAgentName ¶
func SetCliUserAgentName(cliUserAgentNameToSet string)
func SetCliUserAgentVersion ¶
func SetCliUserAgentVersion(versionToSet string)
func SetClientAgentName ¶
func SetClientAgentName(clientAgentToSet string)
func SetClientAgentVersion ¶
func SetClientAgentVersion(versionToSet string)
func SetIfEmpty ¶
func SetPermissionsRecursively ¶ added in v2.41.7
func SpecVarsStringToMap ¶
func SumTrueValues ¶
Types ¶
type Credentials ¶
type GeneralExecCmd ¶
Command used to execute general commands.
func (*GeneralExecCmd) GetCmd ¶
func (pluginCmd *GeneralExecCmd) GetCmd() *exec.Cmd
func (*GeneralExecCmd) GetEnv ¶
func (pluginCmd *GeneralExecCmd) GetEnv() map[string]string
func (*GeneralExecCmd) GetErrWriter ¶
func (pluginCmd *GeneralExecCmd) GetErrWriter() io.WriteCloser
func (*GeneralExecCmd) GetStdWriter ¶
func (pluginCmd *GeneralExecCmd) GetStdWriter() io.WriteCloser
type OnError ¶
type OnError string
Error modes (how should the application behave when the CheckError function is invoked):
type Technology ¶ added in v2.7.0
type Technology string
const ( Maven Technology = "maven" Gradle Technology = "gradle" Npm Technology = "npm" Yarn Technology = "yarn" Go Technology = "go" Pip Technology = "pip" Pipenv Technology = "pipenv" Poetry Technology = "poetry" Nuget Technology = "nuget" Dotnet Technology = "dotnet" Docker Technology = "docker" )
func GetAllTechnologiesList ¶ added in v2.18.7
func GetAllTechnologiesList() (technologies []Technology)
func ToTechnologies ¶ added in v2.12.0
func ToTechnologies(args []string) (technologies []Technology)
func (Technology) ApplicabilityScannable ¶ added in v2.39.3
func (tech Technology) ApplicabilityScannable() bool
func (Technology) GetExecCommandName ¶ added in v2.20.7
func (tech Technology) GetExecCommandName() string
func (Technology) GetPackageDescriptor ¶ added in v2.20.7
func (tech Technology) GetPackageDescriptor() string
func (Technology) GetPackageInstallationCommand ¶ added in v2.40.1
func (tech Technology) GetPackageInstallationCommand() string
func (Technology) GetPackageType ¶ added in v2.20.7
func (tech Technology) GetPackageType() string
func (Technology) GetPackageVersionOperator ¶ added in v2.41.5
func (tech Technology) GetPackageVersionOperator() string
func (Technology) IsCiSetup ¶ added in v2.20.7
func (tech Technology) IsCiSetup() bool
func (Technology) ToFormal ¶ added in v2.20.7
func (tech Technology) ToFormal() string
func (Technology) ToString ¶ added in v2.20.7
func (tech Technology) ToString() string