utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package utils provides utility functions and helpers for batch-tool.

Index

Constants

This section is empty.

Variables

View Source
var CatalogLookup = defaultCatalogLookup

CatalogLookup is a function type for looking up project from catalog

Functions

func BindBoolFlags added in v0.9.6

func BindBoolFlags(cmd *cobra.Command, key, yesName, noName string) error

BindBoolFlags binds a pair of mutually exclusive boolean flags to the current viper context.

func BuildBoolFlags added in v0.9.6

func BuildBoolFlags(cmd *cobra.Command, yesName, yesShort, noName, noShort, description string)

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 CheckMutuallyExclusiveFlags added in v0.9.6

func CheckMutuallyExclusiveFlags(cmd *cobra.Command, flags ...string) error

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

func CleanFilter(ctx context.Context, input string) string

CleanFilter standardizes the formatting of an imput argument by removing all configured signal tokens

func ExecEnv added in v0.10.0

func ExecEnv(ctx context.Context, repo string) []string

ExecEnv constructs the environment variables for an Exec call

func LookupBranch

func LookupBranch(ctx context.Context, name string) (string, error)

LookupBranch returns the target branch for the given repository

func ParseRepo

func ParseRepo(ctx context.Context, repo string) (host, project, name string)

ParseRepo splits a repo identifier into its component parts

func RepoPath

func RepoPath(ctx context.Context, repo string) string

RepoPath returns the full repository path for the given name

func RepoURL

func RepoURL(ctx context.Context, repo string) string

RepoURL returns the repository remote url for the given name

func ValidateEnumConfig added in v0.9.6

func ValidateEnumConfig(cmd *cobra.Command, key string, validChoices []string) error

ValidateEnumConfig validates that a config value is one of the allowed choices.

func ValidateRequiredConfig

func ValidateRequiredConfig(ctx context.Context, opts ...string) error

ValidateRequiredConfig checks viper and returns an error if a key isn't set

Types

This section is empty.

Directories

Path Synopsis
Package testing provides utility functions for testing purposes across multiple packages.
Package testing provides utility functions for testing purposes across multiple packages.

Jump to

Keyboard shortcuts

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