Help us shape the future of Go! Take the 2026 Go Developer Survey

ref

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ref handles parsing and formatting of [namespace/]name composite references supplied via the `--resource` CLI flag. Parse and Format are inverses: Parse turns a user-typed string into a NamespacedName, Format turns a NamespacedName back into the user's original spelling (bare "name" for cluster-scoped, "namespace/name" for namespaced).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(n k8stypes.NamespacedName) string

Format renders a NamespacedName the way the user typed it on the command line: bare "name" for cluster-scoped, "namespace/name" for namespaced.

NamespacedName.String() always renders "namespace/name" (so "/foo" for cluster-scoped), which is wrong for human-facing output where users expect their original spelling.

func Parse

func Parse(value string) (k8stypes.NamespacedName, error)

Parse parses a "[namespace/]name" CLI arg into a NamespacedName. Bare "name" (no slash) means cluster-scoped (v1 XRs, v2 cluster-scoped XRs). "ns/name" means namespaced (Claims, v2 namespaced XRs). "/name" (empty namespace before slash) is rejected because the user's intent is clearly namespaced.

func ParseAll

func ParseAll(values []string) ([]k8stypes.NamespacedName, error)

ParseAll parses each value via Parse and returns the resulting slice. Returns (nil, error) on the first parse failure — no partial results. Returns (nil, nil) for an empty input.

Types

This section is empty.

Jump to

Keyboard shortcuts

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