domain

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: BSD-3-Clause-LBNL Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RootCommand

type RootCommand struct {
	NameP string

	TableObj table.Writer

	CommandEntries []simplecobra.Commander
	// contains filtered or unexported fields
}

RootCommand struct wraps the root command and supporting services needed

func NewRootCommand

func NewRootCommand(name string) *RootCommand

func (*RootCommand) ApplyOptions

func (c *RootCommand) ApplyOptions(options ...RootOption) error

ApplyOptions Allows to construct a root command passing any number of arguments to set RootCommand Options

func (*RootCommand) Commands

func (c *RootCommand) Commands() []simplecobra.Commander

Commands returns a list of Cobra commands

func (*RootCommand) ConfigSvc

ConfigSvc returns the root command's configuration object.

func (*RootCommand) GrafanaSvc

func (c *RootCommand) GrafanaSvc() ports.GrafanaService

GrafanaSvc returns the configured GrafanaService instance, initializing it if nil.

func (*RootCommand) Init

func (c *RootCommand) Init(cd *simplecobra.Commandeer) error

Init invoked to Initialize the RootCommand object

func (*RootCommand) LoadConfig

func (c *RootCommand) LoadConfig(configOverride, contextOverride string) *config_domain.GDGAppConfiguration

LoadConfig Loads configuration, and setups fail over case

func (*RootCommand) Name

func (c *RootCommand) Name() string

Name returns the cli command name

func (*RootCommand) PreRun

func (c *RootCommand) PreRun(this, runner *simplecobra.Commandeer) error

PreRun executed prior to command invocation

func (*RootCommand) Render

func (c *RootCommand) Render(command *cobra.Command, data any)

Render outputs data as JSON if --output=json, otherwise renders a table.

func (*RootCommand) Run

func (c *RootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error

Run invokes the CLI command

func (*RootCommand) SetService

func (c *RootCommand) SetService(svc ports.GrafanaService)

func (*RootCommand) SetServiceFactory

func (c *RootCommand) SetServiceFactory(factory func(*config_domain.GDGAppConfiguration) ports.GrafanaService)

SetServiceFactory registers a factory function that builds a GrafanaService from a loaded configuration. LoadConfig will call it automatically the first time config is loaded, so commands that don't need a config (version, default-config, help) never trigger it.

func (*RootCommand) SetUpTest

func (c *RootCommand) SetUpTest(app ports.GrafanaService)

SetUpTest initializes the RootCommand for testing by setting a mock GrafanaService and loading test configuration. It only runs when the TESTING environment variable is set to "1".

type RootOption

type RootOption func(command *RootCommand)

RootOption used to configure the Root Command struct

type SimpleCommand

type SimpleCommand struct {
	NameP     string
	Short     string
	Long      string
	RunFunc   func(ctx context.Context, cd *simplecobra.Commandeer, rootCmd *RootCommand, args []string) error
	WithCFunc func(cmd *cobra.Command, r *RootCommand)
	InitCFunc func(cd *simplecobra.Commandeer, runner *simplecobra.Commandeer, r *RootCommand) error

	CommandsList []simplecobra.Commander

	RootCmd *RootCommand
	// contains filtered or unexported fields
}

SimpleCommand wraps a simple command

func (*SimpleCommand) Commands

func (c *SimpleCommand) Commands() []simplecobra.Commander

Commands is a list of subcommands

func (*SimpleCommand) Init

Init initializes the SimpleCommand

func (*SimpleCommand) Name

func (c *SimpleCommand) Name() string

Name returns function Name

func (*SimpleCommand) PreRun

func (c *SimpleCommand) PreRun(cd, runner *simplecobra.Commandeer) error

PreRun executed prior to cli command execution

func (*SimpleCommand) Run

func (c *SimpleCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error

Run executes cli command

func (*SimpleCommand) SetName

func (c *SimpleCommand) SetName(name string)

SetName Function allows name to be set

Jump to

Keyboard shortcuts

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