common

package
v2.58.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 15 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 ExtractArguments

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

func FixWinPathsForFileSystemSourcedCmds

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

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 GetFileSystemSpec

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

func GetPrintCurrentCmdHelp

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

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 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 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

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳