cmd

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapInvocationContext added in v1.0.5

func BootstrapInvocationContext(args []string) (cmdutil.InvocationContext, error)

BootstrapInvocationContext extracts global invocation options before the real command tree is built, so provider-backed config resolution sees the correct profile from the start.

func Build added in v1.0.16

Build constructs the full command tree without executing. Returns only the cobra.Command; Factory is internal. Use Execute for the standard production entry point.

func Execute

func Execute() int

Execute runs the root command and returns the process exit code.

func RegisterGlobalFlags added in v1.0.5

func RegisterGlobalFlags(fs *pflag.FlagSet, opts *GlobalOptions)

RegisterGlobalFlags registers the root-level persistent flags on fs and applies any visibility policy encoded in opts. Pure function: no disk, network, or environment reads — the caller decides HideProfile.

func SetDefaultFS added in v1.0.16

func SetDefaultFS(fs vfs.FS)

SetDefaultFS replaces the global filesystem implementation used by internal packages. The provided fs must implement the vfs.FS interface. If fs is nil, the default OS filesystem is restored.

Call this before Build or Execute to take effect.

Types

type BuildOption added in v1.0.16

type BuildOption func(*buildConfig)

BuildOption configures optional aspects of the command tree construction.

func HideProfile added in v1.0.16

func HideProfile(hide bool) BuildOption

HideProfile sets the visibility policy for the root-level --profile flag. When hide is true the flag stays registered (so existing invocations still parse) but is omitted from help and shell completion. Typically called as HideProfile(isSingleAppMode()).

func WithIO added in v1.0.16

func WithIO(in io.Reader, out, errOut io.Writer) BuildOption

WithIO sets the IO streams for the CLI by wrapping raw reader/writers. Terminal detection is delegated to cmdutil.NewIOStreams.

func WithKeychain added in v1.0.16

func WithKeychain(kc keychain.KeychainAccess) BuildOption

WithKeychain sets the secret storage backend. If not provided, the platform keychain is used.

type GlobalOptions added in v1.0.5

type GlobalOptions struct {
	Profile     string
	HideProfile bool
}

GlobalOptions are the root-level flags shared by bootstrap parsing and the actual Cobra command tree. Profile is the parsed --profile value; HideProfile is a build-time policy — when true, --profile stays parseable but is marked hidden from help and shell completion.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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