root

package
v0.10.257 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 8 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 AddJSONFlag added in v0.10.228

func AddJSONFlag(cmd *cobra.Command, target *bool)

AddJSONFlag adds the shared --json output flag to cmd.

func Execute

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

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

func NewProgressLogger added in v0.10.228

func NewProgressLogger(opts *Options) *progress.Logger

NewProgressLogger returns a progress logger configured from root options.

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
	Quiet      bool
	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 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