root

package
v1.1.67 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package root provides the top-level gro command and global flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute runs the root command with a background context

func ExecuteContext added in v1.0.35

func ExecuteContext(ctx context.Context)

ExecuteContext runs the root command with the given context. os.Exit stays strictly AFTER runRoot returns so runRoot's deferred FlushMigrationNotice is never skipped by the exit (it would be if the defer lived here).

func WireBackendSelection added in v1.0.53

func WireBackendSelection(cmd *cobra.Command) error

WireBackendSelection validates the user-supplied --backend flag and records it for the next keychain.Open* call. Cobra-layer only — it does NOT load config; openWith binds the flag pair against cfg.Keyring.Backend at the single credstore.Open call site.

Exported so a subcommand that defines its own PersistentPreRunE can call it explicitly: cobra does NOT chain PersistentPreRunE, so a shadowing subcommand silently loses the wiring without this hook. gro has no shadowers today; the regression test guards the pattern.

Reads via cmd.Flag() so persistent-flag inheritance works from any subcommand path.

func WireCredentialRefSelection added in v1.1.67

func WireCredentialRefSelection(cmd *cobra.Command) error

WireCredentialRefSelection records the user-supplied --ref flag for the next keychain.Open* call and validates its <service>/<profile> shape up front so a bad value fails with a clear "--ref" error before any keyring work. The resolved precedence (--ref flag > <SERVICE>_CREDENTIAL_REF env > config credential_ref) is applied at keychain.open; this hook only records the flag.

Like WireBackendSelection, it is exported because cobra does NOT chain PersistentPreRunE — a subcommand that defines its own must call this explicitly. Reads via cmd.Flag() so persistent-flag inheritance works from any subcommand path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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