Documentation
¶
Index ¶
- type RootCommand
- func (c *RootCommand) Commands() []simplecobra.Commander
- func (c *RootCommand) ConfigSvc() *domain.GDGAppConfiguration
- func (c *RootCommand) GrafanaSvc() service.GrafanaService
- func (c *RootCommand) Init(cd *simplecobra.Commandeer) error
- func (c *RootCommand) InitConfiguration(cmd *cobra.Command)
- func (c *RootCommand) Name() string
- func (c *RootCommand) PreRun(this, runner *simplecobra.Commandeer) error
- func (c *RootCommand) Render(command *cobra.Command, data any)
- func (c *RootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error
- func (c *RootCommand) SetUpTest(app service.GrafanaService)
- type RootOption
- type SimpleCommand
- func (c *SimpleCommand) Commands() []simplecobra.Commander
- func (c *SimpleCommand) Init(cd *simplecobra.Commandeer) error
- func (c *SimpleCommand) Name() string
- func (c *SimpleCommand) PreRun(cd, runner *simplecobra.Commandeer) error
- func (c *SimpleCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error
- func (c *SimpleCommand) SetName(name string)
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 NewRootCmd ¶
func NewRootCmd(root *RootCommand, options ...RootOption) *RootCommand
NewRootCmd 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 ¶ added in v0.9.1
func (c *RootCommand) ConfigSvc() *domain.GDGAppConfiguration
ConfigSvc returns the root command's configuration object.
func (*RootCommand) GrafanaSvc ¶
func (c *RootCommand) GrafanaSvc() service.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) InitConfiguration ¶ added in v0.9.1
func (c *RootCommand) InitConfiguration(cmd *cobra.Command)
InitConfiguration Loads configuration, and setups fail over case
func (*RootCommand) PreRun ¶
func (c *RootCommand) PreRun(this, runner *simplecobra.Commandeer) error
PreRun executed prior to command invocation
func (*RootCommand) Render ¶ added in v0.6.0
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) SetUpTest ¶ added in v0.9.1
func (c *RootCommand) SetUpTest(app service.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, 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 ¶
func (c *SimpleCommand) Init(cd *simplecobra.Commandeer) error
Init initializes the SimpleCommand
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