Documentation
¶
Overview ¶
Package utils provides utility functions and helpers for batch-tool.
Index ¶
- Variables
- func BindBoolFlags(cmd *cobra.Command, key, yesName, noName string) error
- func BuildBoolFlags(cmd *cobra.Command, yesName, yesShort, noName, noShort, description string)
- func BuildBoolFlagsDefault(cmd *cobra.Command, yesName, yesShort, noName, noShort string, ...)
- func CheckMutuallyExclusiveFlags(cmd *cobra.Command, flags ...string) error
- func CleanFilter(ctx context.Context, input string) string
- func Cmd(ctx context.Context, repo, command string, arguments ...string) (*exec.Cmd, error)
- func Env(ctx context.Context, repo string) ([]string, error)
- func LookupBranch(ctx context.Context, name string) (string, error)
- func ParseRepo(ctx context.Context, repo string) (host, project, name string)
- func RepoPath(ctx context.Context, repo string) string
- func RepoURL(ctx context.Context, repo string) string
- func ValidateEnumConfig(cmd *cobra.Command, key string, validChoices []string) error
- func ValidateRequiredConfig(ctx context.Context, opts ...string) error
Constants ¶
This section is empty.
Variables ¶
var ( // CatalogProjectLookup is a function type for looking up project from catalog CatalogProjectLookup = defaultProjectLookup // CatalogBranchLookup is a function type for looking up branch from catalog CatalogBranchLookup = defaultBranchLookup )
functions initialized in catalog package to avoid circular import
Functions ¶
func BindBoolFlags ¶ added in v0.9.6
BindBoolFlags binds a pair of mutually exclusive boolean flags to the current viper context.
func BuildBoolFlags ¶ added in v0.9.6
BuildBoolFlags adds a pair of mutually exclusive boolean flags to the given command. The "yes" flag enables the feature (default true), and the "no" flag disables it.
func BuildBoolFlagsDefault ¶ added in v0.11.0
func BuildBoolFlagsDefault(cmd *cobra.Command, yesName, yesShort, noName, noShort string, defaultValue bool, description string)
BuildBoolFlagsDefault adds a pair of mutually exclusive boolean flags to the given command with a specified default value.
func CheckMutuallyExclusiveFlags ¶ added in v0.9.6
CheckMutuallyExclusiveFlags validates that at most one flag from each set of mutually exclusive flags is set. Each argument is a slice of flag names that are mutually exclusive with each other. Returns an error if more than one flag in any set is explicitly set.
func CleanFilter ¶ added in v0.9.6
CleanFilter standardizes the formatting of an imput argument by removing all configured signal tokens
func Cmd ¶ added in v0.11.0
Cmd creates an exec.Cmd configured for the given repository context, to facilitate consistent environment and working directory setup.
func Env ¶ added in v0.11.0
Env constructs the environment variables for an Exec call. It processes the CmdEnv config which can contain either: - key=value pairs (used as-is) - file paths to .env files (read and all values added to environment) If a file path is provided but cannot be read, an error is returned.
func LookupBranch ¶
LookupBranch returns the target branch for the given repository
func ValidateEnumConfig ¶ added in v0.9.6
ValidateEnumConfig validates that a config value is one of the allowed choices.
Types ¶
This section is empty.