Documentation
¶
Index ¶
- func AnyFlagChanged(cmd *cobra.Command, flags []string) bool
- func ApplyIPs(existing []string, changes *IPChanges) []string
- func ApplyLabels(existing []*commonv1.KeyValue, changes *LabelChanges) []*commonv1.KeyValue
- func ConfirmAction(force bool, w io.Writer, prompt string) bool
- func ExactArgs(n int, usage string) cobra.PositionalArgs
- func IsUUID(s string) bool
- type IPChanges
- type LabelChanges
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyFlagChanged ¶ added in v0.16.0
AnyFlagChanged reports whether any flag in the given list was set by the user.
func ApplyIPs ¶ added in v0.10.1
ApplyIPs applies IPChanges to an existing IP list and returns a new sorted slice. The input slice is not modified. Removing an IP that does not exist is a silent no-op.
func ApplyLabels ¶ added in v0.10.1
func ApplyLabels(existing []*commonv1.KeyValue, changes *LabelChanges) []*commonv1.KeyValue
ApplyLabels applies LabelChanges to an existing label set and returns a new slice sorted by key. The input slice is not modified. Removing a key that does not exist is a silent no-op.
func ConfirmAction ¶
ConfirmAction prompts the user for confirmation. Returns true if they confirm. If force is true, skips the prompt and returns true. The prompt is written to w.
Types ¶
type IPChanges ¶ added in v0.10.1
IPChanges holds the parsed result of --allowed-ip flags.
type LabelChanges ¶ added in v0.10.1
LabelChanges holds the parsed result of --label flags.
func ParseLabels ¶ added in v0.10.1
func ParseLabels(raw []string) (*LabelChanges, error)
ParseLabels parses a slice of raw --label flag values into upserts and removals.
Accepted forms:
- "key=value" -- upsert (empty value is valid: "key=")
- "key-" -- remove the label with that key
Returns an error for malformed entries like "key" (no = and no trailing -), "=value" (empty key), or "" (empty string).
When the same key appears multiple times, the last occurrence wins.