cmdregistry

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 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

Package cmdregistry is the seam between Stainless-generated CLI code in pkg/cmd and hand-written extension subpackages under pkg/cmd/extensions/.

Why this exists:

pkg/cmd is generated from the OpenAPI spec by Stainless and is rewritten on every regen. Extension subpackages that want to add hand-written top-level commands (for example, the webhook listen tunnel tool) cannot directly mutate pkg/cmd's command tree from their init() because doing so requires importing pkg/cmd, while pkg/cmd's bridge file (zz_extensions.go) needs to import them — that's a cycle. This package breaks the cycle: extensions Register here, and the bridge in pkg/cmd Drains here.

Usage from an extension subpackage:

func init() {
    cmdregistry.Register(&cli.Command{Name: "my:tool", ...})
}

Usage from the bridge in pkg/cmd:

func init() {
    cmd.Command.Commands = append(cmd.Command.Commands, cmdregistry.Drain()...)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drain

func Drain() []*cli.Command

Drain returns every command registered so far and clears the pending set. Intended to be called once, from the bridge file in pkg/cmd that splices extensions into the generated command tree.

func Register

func Register(c *cli.Command)

Register adds a hand-written top-level command to the pending set. Safe to call from any package's init().

Types

This section is empty.

Jump to

Keyboard shortcuts

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