Documentation
¶
Index ¶
- Variables
- func InitConfiguration(cmd *cobra.Command)
- type RootCommand
- func (c *RootCommand) Commands() []simplecobra.Commander
- func (c *RootCommand) Init(cd *simplecobra.Commandeer) error
- func (c *RootCommand) Name() string
- func (c *RootCommand) PreRun(this, runner *simplecobra.Commandeer) error
- func (cmd *RootCommand) Render(command *cobra.Command, data any)
- func (c *RootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error
- 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 ¶
var DefaultConfig string
Functions ¶
func InitConfiguration ¶
InitConfiguration Loads configuration, and setups fail over case
Types ¶
type RootCommand ¶
type RootCommand struct { NameP string GrafanaSvc func() service.GrafanaService 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) Init ¶
func (c *RootCommand) Init(cd *simplecobra.Commandeer) error
Init invoked to Initialize the RootCommand object
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 (cmd *RootCommand) Render(command *cobra.Command, data any)
func (*RootCommand) Run ¶
func (c *RootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error
Run invokes the CLI command
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