cli

package
v0.4.0 Latest Latest
Warning

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

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

README

pkg/cli

Root builds an arctl command tree from Config.

Downstream CLIs should put customization in the config they pass to Root:

root := cli.Root(cli.Config{
	Version: version.Version,
	Auth: enterpriseAuthProvider{},
	Disabled: map[string]bool{
		"db migrate goto": true,
	},
	ExtraCommands: []*cobra.Command{
		runtime.NewCommand(),
		user.UserCommand(ctx),
	},
	ExtraMigrationSources: []migrate.Source{
		entlegacymigrate.EnterpriseSource(),
	},
})

The OSS migration source is always registered first by Root. Extra migration sources are appended in config order. When more than one source is present, db migrate exposes --source; single-source CLIs omit it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Root

func Root(cfg Config) *cobra.Command

Root creates a fresh arctl root command from Config.

Types

type Config added in v0.4.0

type Config struct {
	Use     string
	Short   string
	Long    string
	Version string

	Env  cliruntime.Env
	Auth cliruntime.AuthProvider

	ExtraCommands []*cobra.Command
	Disabled      map[string]bool // command paths to remove, such as "db migrate goto"

	ExtraMigrationSources []migrate.Source
	DeclarativeKinds      []DeclarativeKind

	OnTokenResolved func(token string) error
}

Config describes one CLI instance.

func DefaultConfig added in v0.4.0

func DefaultConfig() Config

type DeclarativeKind added in v0.4.0

type DeclarativeKind struct {
	Name          string
	Plural        string
	CanonicalKind string
	Aliases       []string
	TableColumns  []string
	NewObject     func() v1alpha1.Object
	Row           func(v1alpha1.Object) []string
}

DeclarativeKind describes a downstream v1alpha1 kind exposed through generic get, list, and delete dispatch.

Directories

Path Synopsis
db
Package db hosts the `arctl db` parent command and its subcommands.
Package db hosts the `arctl db` parent command and its subcommands.
migrate
Package migrate exposes the `arctl db migrate` subcommand.
Package migrate exposes the `arctl db migrate` subcommand.

Jump to

Keyboard shortcuts

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