common

package
v2.60.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 21 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupResult added in v2.58.3

func CleanupResult(result *commandUtils.Result, err *error)

func CreateArtifactoryDetailsByFlags added in v2.58.3

func CreateArtifactoryDetailsByFlags(c *components.Context) (*coreConfig.ServerDetails, error)

func CreateBuildConfiguration

func CreateBuildConfiguration(c *components.Context) *build.BuildConfiguration

Returns build configuration struct using the args (build name/number) and options (project) provided by the user. Any empty configuration could be later overridden by environment variables if set.

func CreateBuildConfigurationWithModule added in v2.58.3

func CreateBuildConfigurationWithModule(c *components.Context) (buildConfigConfiguration *buildUtils.BuildConfiguration, err error)

Returns build configuration struct using the options provided by the user. Any empty configuration could be later overridden by environment variables if set.

func CreateServerDetailsFromFlags

func CreateServerDetailsFromFlags(c *components.Context) (details *config.ServerDetails, err error)

func CreateServerDetailsWithConfigOffer

func CreateServerDetailsWithConfigOffer(c *components.Context, excludeRefreshableTokens bool, domain cliUtils.CommandDomain) (*config.ServerDetails, error)

Exclude refreshable tokens parameter should be true when working with external tools (build tools, curl, etc) or when sending requests not via ArtifactoryHttpClient.

func CreateSummaryReportString added in v2.58.3

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

func ExtractArguments

func ExtractArguments(context *components.Context) []string

func ExtractCommand added in v2.58.3

func ExtractCommand(c *components.Context) []string

func FixWinPathsForFileSystemSourcedCmds

func FixWinPathsForFileSystemSourcedCmds(uploadSpec *spec.SpecFiles, c *components.Context)

func GetBuildName added in v2.58.3

func GetBuildName(buildName string) string

func GetBuildUrl added in v2.58.3

func GetBuildUrl(buildUrl string) string

func GetCliError added in v2.58.3

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

func GetCommandFlags

func GetCommandFlags(cmdKey string, commandToFlags map[string][]string, flagsMap map[string]components.Flag) []components.Flag

Return a sorted list of a command's flags by a given command key.

func GetDetailedSummary added in v2.58.3

func GetDetailedSummary(c *components.Context) bool

func GetDocumentationMessage added in v2.58.3

func GetDocumentationMessage() string

func GetEnvExclude added in v2.58.3

func GetEnvExclude(envExclude string) string

func GetFileSystemSpec

func GetFileSystemSpec(c *components.Context) (fsSpec *spec.SpecFiles, err error)

func GetPrintCurrentCmdHelp

func GetPrintCurrentCmdHelp(c *components.Context) func() error

func GetProject added in v2.58.3

func GetProject(c *components.Context) string

Get project key from flag or environment variable

func GetQuietValue added in v2.58.1

func GetQuietValue(c *components.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 GetServerDetails

func GetServerDetails(c *components.Context) (*config.ServerDetails, error)

Return the Artifactory Details of the provided 'server-id', or the default one.

func GetServerIdFlag

func GetServerIdFlag() components.StringFlag

Get the common 'server-id' flag

func GetStringsArrFlagValue

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

func GetThreadsCount

func GetThreadsCount(c *components.Context) (threads int, err error)

func HandleSecretInput

func HandleSecretInput(c *components.Context, stringFlag, stdinFlag string) (secret string, err error)

Get a secret value from a flag or from stdin.

func IsFailNoOp added in v2.58.3

func IsFailNoOp(context *components.Context) bool

func OverrideArrayIfSet

func OverrideArrayIfSet(field *[]string, c *components.Context, fieldName string)

If `fieldName` exist in the cli args, read it to `field` as an array split by `;`.

func OverrideIntIfSet

func OverrideIntIfSet(field *int, c *components.Context, fieldName string)

If `fieldName` exist in the cli args, read it to `field` as a int.

func OverrideSpecFieldsIfSet

func OverrideSpecFieldsIfSet(spec *spec.File, c *components.Context)

func OverrideStringIfSet

func OverrideStringIfSet(field *string, c *components.Context, fieldName string)

If `fieldName` exist in the cli args, read it to `field` as a string.

func PrintBriefSummaryReport added in v2.58.3

func PrintBriefSummaryReport(success, failed int, failNoOp bool, originalErr error) error

func PrintCommandSummary added in v2.58.3

func PrintCommandSummary(result *commandUtils.Result, detailedSummary, printDeploymentView, failNoOp bool, originalErr error) (err error)

func PrintDeploymentView added in v2.58.3

func PrintDeploymentView(reader *content.ContentReader) error

Print a file tree based on the items' path in the reader's list.

func PrintDetailedSummaryReport added in v2.58.3

func PrintDetailedSummaryReport(basicSummary string, reader *content.ContentReader, uploaded 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 *components.Context) error

func RunCmdWithDeprecationWarning

func RunCmdWithDeprecationWarning(cmdName, oldSubcommand string, c *components.Context,
	cmd func(c *components.Context) error) error

func ShowCmdHelpIfNeeded

func ShowCmdHelpIfNeeded(c *components.Context, args []string) (bool, error)

This function checks whether the command received --help as a single option. If it did, the command's help is shown and true is returned. This function should be used iff the SkipFlagParsing option is used.

func WrongNumberOfArgumentsHandler

func WrongNumberOfArgumentsHandler(context *components.Context) error

Types

type DetailedSummaryRecord added in v2.58.3

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

type ExtendedDetailedSummaryRecord added in v2.58.3

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

Jump to

Keyboard shortcuts

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