cmdregistry

package
v0.0.0-...-059d9f2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

A table lives next to the dispatcher it feeds (pkg/cmd/create/table.go, and so on) so that adding a resource stays a one-line edit in the package that owns the verb.

Index

Constants

View Source
const Fallback = apiversion.V4

Fallback is the generation assumed when a factory carries no resolved version. The root command always resolves one, so this covers callers that build a command tree on their own — documentation generation and unit tests — which saw the v4 tree before these tables existed.

Variables

This section is empty.

Functions

func Children

func Children(entries []Entry, f *cmdutil.Factory) []*cobra.Command

Children builds the entries that the factory's generation is entitled to, in table order. Cobra sorts sub-commands for display, so the order here only affects the order of construction.

func Example

func Example(examples map[apiversion.Version]string, f *cmdutil.Factory) string

Example picks the example block for the factory's generation.

Types

type Builder

type Builder func(f *cmdutil.Factory) *cobra.Command

Builder constructs a command. It is the signature every NewCmd already has.

type Entry

type Entry struct {
	// Versions limits the entry to those generations. An empty Versions means
	// the command is version-agnostic and is offered to every generation.
	Versions []apiversion.Version
	// New constructs the command.
	New Builder
}

Entry is one sub-command and the generations it is offered to.

func Any

func Any(new Builder) Entry

Any registers a command that behaves the same on every generation, v6 included: it does not call a resource API (version, whoami, profiles...).

func V3Only

func V3Only(new Builder) Entry

V3Only registers a command that exists only on the v3 generation.

func V3V4

func V3V4(new Builder) Entry

V3V4 registers a command that v3 and v4 share and v6 does not offer yet, such as the resource CRUD verbs.

func V4Only

func V4Only(new Builder) Entry

V4Only registers a command that exists only on the v4 generation.

func V4V6

func V4V6(new Builder) Entry

V4V6 registers a command that v4 and v6 share: one implementation that picks what differs from the factory's generation (build, dev, init, link, login).

func V6Only

func V6Only(new Builder) Entry

V6Only registers a command implementation that exists only on v6.

func (Entry) Supports

func (e Entry) Supports(v apiversion.Version) bool

Supports reports whether the entry is offered to generation v.

v6 sees only the entries that name it: Any, V4V6 and V6Only. An entry that names v4 alone is not offered to v6, so a v6 account never runs a command that calls the v4 API.

Jump to

Keyboard shortcuts

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