Documentation
¶
Index ¶
- Constants
- func AssertValueProvided(c *components.Context, fieldName string) error
- func ParseDelimitedSlice(input string) [][]string
- func ParseKeyValueString(value, separator string) (map[string]string, error)
- func ParseListPropertiesFlag(propertiesStr string) (map[string][]string, error)
- func ParseMapFlag(flagValue string) (map[string]string, error)
- func ParseNameVersionPairs(input string) ([][2]string, error)
- func ParseSliceFlag(flagValue string) []string
- func ServerDetailsByFlags(ctx *components.Context) (*coreConfig.ServerDetails, error)
- func ValidateEnumFlag(flagName, value string, defaultValue string, allowedValues []string) (string, error)
Constants ¶
const ( EntrySeparator = ";" PartSeparator = ":" )
Variables ¶
This section is empty.
Functions ¶
func AssertValueProvided ¶
func AssertValueProvided(c *components.Context, fieldName string) error
func ParseDelimitedSlice ¶
ParseDelimitedSlice splits a delimited string into a slice of string slices. Example: input "a:1;b:2" returns [][]string{{"a","1"},{"b","2"}}
func ParseKeyValueString ¶
func ParseListPropertiesFlag ¶
ParseListPropertiesFlag parses a properties string into a map of keys to value slices. Format: "key1=value1[,value2,...];key2=value3[,value4,...]" Examples:
- "status=rc" -> {"status": ["rc"]}
- "status=rc,validated" -> {"status": ["rc", "validated"]}
- "status=rc;deployed_to=staging" -> {"status": ["rc"], "deployed_to": ["staging"]}
- "old_flag=" -> {"old_flag": []} (clears values)
func ParseMapFlag ¶
ParseMapFlag parses a semicolon-separated string of key=value pairs into a map[string]string. Returns an error if any pair does not contain exactly one '='.
func ParseNameVersionPairs ¶
ParseNameVersionPairs parses a delimited string (e.g., "name1:version1;name2:version2") into a slice of [2]string pairs. Returns an error if any entry does not have exactly two parts.
func ParseSliceFlag ¶
ParseSliceFlag parses a comma-separated string into a slice of strings.
func ServerDetailsByFlags ¶
func ServerDetailsByFlags(ctx *components.Context) (*coreConfig.ServerDetails, error)
func ValidateEnumFlag ¶
func ValidateEnumFlag(flagName, value string, defaultValue string, allowedValues []string) (string, error)
ValidateEnumFlag validates that a flag value is in the list of allowed values. If the value is empty, returns the default value. Otherwise, returns an error if the value is not in the allowed values.
Types ¶
This section is empty.