root

package
v0.3.146 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package root builds the cr root command and owns root-level command wiring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(cmd *cobra.Command, args []string) error

Execute runs cmd with args and maps unknown commands into cr usage errors.

func ProfileFlagChanged added in v0.3.77

func ProfileFlagChanged(cmd *cobra.Command) bool

ProfileFlagChanged reports whether the inherited --profile flag was supplied.

func RegisterAll

func RegisterAll(cmd *cobra.Command, opts *Options, fns ...RegisterFunc)

RegisterAll applies child-command registrars to a root command tree.

Types

type Options

type Options struct {
	Profile    string
	Backend    string
	ConfigPath string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
}

Options carries root-level command dependencies and persistent options.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns root options wired to the process stdio streams.

func NewCommand

func NewCommand() (*cobra.Command, *Options)

NewCommand builds a fresh cr root command and its injectable options.

func NewCommandWithOptions

func NewCommandWithOptions(opts *Options) (*cobra.Command, *Options)

NewCommandWithOptions builds a fresh cr root command using caller-provided options and wires the command output streams from those options.

type RegisterFunc

type RegisterFunc func(rootCmd *cobra.Command, opts *Options)

RegisterFunc attaches a command subtree to the root command.

Jump to

Keyboard shortcuts

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