Documentation
¶
Index ¶
- Variables
- func GetLogLevelFromArgs(args []string) slog.Level
- func HelpFuncE(cmd *cobra.Command, args []string) error
- func RunCatchFuncE(cmd *cobra.Command, args []string) error
- func SubCommandInitializePrintNameFunc(cmd *cobra.Command)
- type Application
- type Command
- type Commander
- type Config
- func (c Config) RegisterCommand(cmd Commander, f func(*cobra.Command))
- func (c Config) RegisterCommands(cmds []Commander, f func(*cobra.Command))
- func (c Config) RegisterPersistentPostRunE(f func(cmd *cobra.Command, args []string) error)
- func (c Config) RegisterPersistentPreRunE(f func(cmd *cobra.Command, args []string) error)
- func (c Config) Validate() error
- type Version
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetLogLevelFromArgs ¶
func RunCatchFuncE ¶
RunCatchFuncE is an empty catch function to allow overrides through persistentPreRunE
Types ¶
type Application ¶
func New ¶
func New(c Config) (Application, error)
type Command ¶
type Config ¶
type Config struct {
Name string
Title string
Banner string
Version Version
EnableGracefulShutdown bool
Logger *slog.Logger
OverrideRunE func(cmd *cobra.Command, args []string) error
PersistentPreRunE []func(cmd *cobra.Command, args []string) error // collection of PreRunE functions
PersistentPostRunE []func(cmd *cobra.Command, args []string) error // collection of PostRunE functions
ShutdownSignals []os.Signal
ShutdownTimeout time.Duration
SubCommands []Commander
SubCommandInitializeFunc func(cmd *cobra.Command)
ValidArgs []string
}
func (Config) RegisterCommand ¶
func (Config) RegisterCommands ¶
func (Config) RegisterPersistentPostRunE ¶
func (Config) RegisterPersistentPreRunE ¶
Click to show internal directories.
Click to hide internal directories.