cliutils

package
v1.51.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// General CLI constants
	CliVersion  = "1.51.1"
	ClientAgent = "jfrog-cli-go"

	// CLI base commands constants:
	CmdArtifactory    = "rt"
	CmdBintray        = "bt"
	CmdMissionControl = "mc"
	CmdXray           = "xr"
	CmdCompletion     = "completion"
	CmdPlugin         = "plugin"
	CmdConfig         = "config"

	// Download
	DownloadMinSplitKb    = 5120
	DownloadSplitCount    = 3
	DownloadMaxSplitCount = 15

	// Common
	Retries             = 3
	Threads             = 3
	TokenExpiry         = 3600
	DefaultLicenseCount = 1

	// Env
	OfferConfig = "JFROG_CLI_OFFER_CONFIG"
	BuildUrl    = "JFROG_CLI_BUILD_URL"
	EnvExclude  = "JFROG_CLI_ENV_EXCLUDE"
	UserAgent   = "JFROG_CLI_USER_AGENT"
)
View Source
const (
	// Artifactory's Commands Keys
	RtConfig                = "rt-config"
	DeleteConfig            = "delete-config"
	Upload                  = "upload"
	Download                = "download"
	Move                    = "move"
	Copy                    = "copy"
	Delete                  = "delete"
	Properties              = "properties"
	Search                  = "search"
	BuildPublish            = "build-publish"
	BuildAppend             = "build-append"
	BuildScan               = "build-scan"
	BuildPromote            = "build-promote"
	BuildDistribute         = "build-distribute"
	BuildDiscard            = "build-discard"
	BuildAddDependencies    = "build-add-dependencies"
	BuildAddGit             = "build-add-git"
	BuildCollectEnv         = "build-collect-env"
	GitLfsClean             = "git-lfs-clean"
	Mvn                     = "mvn"
	MvnConfig               = "mvn-config"
	Gradle                  = "gradle"
	GradleConfig            = "gradle-config"
	DockerPromote           = "docker-promote"
	ContainerPull           = "container-pull"
	ContainerPush           = "container-push"
	BuildDockerCreate       = "build-docker-create"
	NpmConfig               = "npm-config"
	Npm                     = "npm"
	NpmPublish              = "npmPublish"
	YarnConfig              = "yarn-config"
	Yarn                    = "yarn"
	NugetConfig             = "nuget-config"
	Nuget                   = "nuget"
	Dotnet                  = "dotnet"
	DotnetConfig            = "dotnet-config"
	Go                      = "go"
	GoConfig                = "go-config"
	GoPublish               = "go-publish"
	GoRecursivePublish      = "go-recursive-publish"
	PipInstall              = "pip-install"
	PipConfig               = "pip-config"
	Ping                    = "ping"
	RtCurl                  = "rt-curl"
	ReleaseBundleCreate     = "release-bundle-create"
	ReleaseBundleUpdate     = "release-bundle-update"
	ReleaseBundleSign       = "release-bundle-sign"
	ReleaseBundleDistribute = "release-bundle-distribute"
	ReleaseBundleDelete     = "release-bundle-delete"
	TemplateConsumer        = "template-consumer"
	RepoDelete              = "repo-delete"
	ReplicationDelete       = "replication-delete"
	PermissionTargetDelete  = "permission-target-delete"
	AccessTokenCreate       = "access-token-create"
	UserCreate              = "user-create"
	UsersCreate             = "users-create"
	UsersDelete             = "users-delete"
	GroupCreate             = "group-create"
	GroupAddUsers           = "group-add-users"
	GroupDelete             = "group-delete"

	// MC's Commands Keys
	McConfig       = "mc-config"
	LicenseAcquire = "license-acquire"
	LicenseDeploy  = "license-deploy"
	LicenseRelease = "license-release"
	JpdAdd         = "jpd-add"
	JpdDelete      = "jpd-delete"
	// XRay's Commands Keys
	XrCurl        = "xr-curl"
	OfflineUpdate = "offline-update"

	// Config commands keys
	AddConfig  = "config-add"
	EditConfig = "config-edit"

	// Unique nuget flags
	NugetArgs    = "nuget-args"
	SolutionRoot = "solution-root"
	// This flag is different than the nugetV2 since it is hidden and used in the 'nuget' cmd, and not the 'nugetc' cmd.
	LegacyNugetV2 = "nuget-v2-protocol"

	UsersGroups = "users-groups"
	Replace     = "replace"
	Admin       = "admin"
)

Variables

This section is empty.

Functions

func CreateBuildInfoSummaryReportString added in v1.47.0

func CreateBuildInfoSummaryReportString(success, failed int, sha256 string, err error) (string, error)

func CreateServerDetailsFromFlags added in v1.45.0

func CreateServerDetailsFromFlags(c *cli.Context) (details *config.ServerDetails)

func CreateSummaryReportString

func CreateSummaryReportString(success, failed int, err error) (string, error)

func ExtractCommand added in v1.41.2

func ExtractCommand(c *cli.Context) (command []string)

func GetBasicBuildToolsFlags added in v1.39.0

func GetBasicBuildToolsFlags() (flags []cli.Flag)

This function is used for mvn and gradle command validation

func GetBuildName added in v1.39.5

func GetBuildName(buildName string) string

func GetBuildUrl added in v1.39.5

func GetBuildUrl(buildUrl string) string

func GetCliError

func GetCliError(err error, success, failed int, failNoOp bool) error

func GetCommandFlags added in v1.39.0

func GetCommandFlags(cmd string) []cli.Flag

func GetDocumentationMessage

func GetDocumentationMessage() string

func GetEnvExclude added in v1.39.5

func GetEnvExclude(envExclude string) string

func GetIntFlagValue

func GetIntFlagValue(c *cli.Context, flagName string, defValue int) (int, error)

func GetInteractiveValue

func GetInteractiveValue(c *cli.Context) bool

This function indicates whether the command should be executed in an interactive mode. If the --interactive option was sent, it is used to determine the mode. If not, the mode will be interactive, unless the CI environment variable was set to true.

func GetLegacyGoFlags added in v1.39.0

func GetLegacyGoFlags() (flags []cli.Flag)

This function is used for legacy (deprecated) go command validation

func GetLegacyNpmFlags added in v1.39.0

func GetLegacyNpmFlags() (flags []cli.Flag)

This function is used for legacy (deprecated) npm command validation

func GetLegacyNugetFlags added in v1.39.0

func GetLegacyNugetFlags() (flags []cli.Flag)

This function is used for legacy (deprecated) nuget command validation

func GetQuietValue

func GetQuietValue(c *cli.Context) bool

This function indicates whether the command should be executed without confirmation warning or not. If the --quiet option was sent, it is used to determine whether to prompt the confirmation or not. If not, the command will prompt the confirmation, unless the CI environment variable was set to true.

func GetSortedCommands added in v1.46.0

func GetSortedCommands(commands cli.CommandsByName) cli.CommandsByName

func GetStringsArrFlagValue

func GetStringsArrFlagValue(c *cli.Context, flagName string) (resultArray []string)

func GetVersion

func GetVersion() string

func IsLegacyGoPublish added in v1.46.4

func IsLegacyGoPublish(c *cli.Context) bool

func PrintBuildInfoSummaryReport added in v1.47.0

func PrintBuildInfoSummaryReport(succeeded bool, sha256 string, originalErr error) error

func PrintDetailedSummaryReport added in v1.47.0

func PrintDetailedSummaryReport(success, failed int, reader *content.ContentReader, printExtendedDetails bool, originalErr error) error

Prints a summary report. If a resultReader is provided, we will iterate over the result and print a detailed summary including the affected files.

func PrintHelpAndReturnError

func PrintHelpAndReturnError(msg string, context *cli.Context) error

func PrintSummaryReport

func PrintSummaryReport(success, failed int, originalErr error) error

func ShouldOfferConfig added in v1.45.0

func ShouldOfferConfig() (bool, error)

Types

type DetailedSummaryRecord added in v1.47.0

type DetailedSummaryRecord struct {
	Source string `json:"source,omitempty"`
	Target string `json:"target"`
}

type ExtendedDetailedSummaryRecord added in v1.48.0

type ExtendedDetailedSummaryRecord struct {
	DetailedSummaryRecord
	Sha256 string `json:"sha256"`
}

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