support

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: BSD-3-Clause-LBNL Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig string

Functions

func InitConfiguration

func InitConfiguration(cmd *cobra.Command)

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) 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 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

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