root

package
v1.2.5 Latest Latest
Warning

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

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

README

Root Command

The entry point and orchestration layer for GTB CLI applications.

Key Responsibilities:

  • Persistent service initialization (Logging, Configuration)
  • Global flag management (--config, --debug, --ci)
  • Lifecycle hooks (PersistentPreRunE)
  • Automatic feature command registration

For detailed documentation on the root command and the application lifecycle, see the Built-in Commands Documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(rootCmd *cobra.Command, props *p.Props)

Execute runs the root command with centralized error handling. It silences Cobra's default error output and routes any error returned by the command tree through ErrorHandler.Check at Fatal level.

func NewCmdRoot

func NewCmdRoot(props *p.Props, subcommands ...*cobra.Command) *cobra.Command

func NewCmdRootWithConfig

func NewCmdRootWithConfig(props *p.Props, configPaths []string, subcommands ...*cobra.Command) *cobra.Command

NewCmdRootWithConfig creates the root command for the CLI application. It accepts additional configuration file paths to be considered during initialization.

Types

type ConfigLoadOptions

type ConfigLoadOptions struct {
	CfgPaths    []string
	ConfigPaths []string
	Props       *p.Props
	AllowEmpty  bool
}

ConfigLoadOptions holds the options needed for loading configuration.

type FlagValues

type FlagValues struct {
	CI    bool
	Debug bool
}

FlagValues holds the command-line flag values extracted from cobra command.

type OutdatedVersionOption

type OutdatedVersionOption func(*outdatedVersionConfig)

OutdatedVersionOption configures handleOutdatedVersion behavior.

func WithForm

func WithForm(formCreator func(*bool) *huh.Form) OutdatedVersionOption

WithForm allows providing a custom form creator for testing.

type UpdateCheckResult

type UpdateCheckResult struct {
	HasUpdated bool
	ShouldExit bool
	Error      error
}

UpdateCheckResult holds the result of checking for updates.

Jump to

Keyboard shortcuts

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