Documentation
¶
Index ¶
- Constants
- Variables
- func GetLogLevelFromArgs(args []string, defaultLevel slog.Level) slog.Level
- func HelpFuncE(cmd *cobra.Command, args []string) error
- func InitializeBannerOnSubCommands(cmd *cobra.Command)
- func InitializeSubCommandPrinter(cmd *cobra.Command)
- func RunCatchFuncE(cmd *cobra.Command, args []string) error
- type Application
- type Builder
- func (b Builder) RegisterCommand(cmd Commander)
- func (b Builder) RegisterCommands(cmds []Commander)
- func (b Builder) RegisterPersistentPostRunE(f func(cmd *cobra.Command, args []string) error)
- func (b Builder) RegisterPersistentPreRunE(f func(cmd *cobra.Command, args []string) error)
- func (b Builder) Validate() error
- type Command
- type Commander
- type LogDestination
- type LogFormat
- type LogLevel
- type LogOutput
- type PersistentFlags
- type Quitter
- type Version
Constants ¶
View Source
const ( LogLevelTrace LogLevel = "trace" LogLevelDebug LogLevel = "debug" LogLevelInfo LogLevel = "info" LogLevelWarn LogLevel = "warn" LogLevelError LogLevel = "error" LogLevelFatal LogLevel = "fatal" LogOutputStdout LogOutput = "stdout" LogOutputStderr LogOutput = "stderr" LogOutputFile LogOutput = "file" LogFormatText LogFormat = "text" LogFormatJson LogFormat = "json" LogFormatColor LogFormat = "color" )
Variables ¶
View Source
var ( DefaultShutdownSignals = []os.Signal{syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT} DefaultShutdownTimeout = time.Second * 5 )
Shutdown configuration
View Source
var PersistentFlagsDefault = PersistentFlags{ AddJsonFlag: false, AddQuietFlag: false, AddNoColorFlag: false, AddVerboseFlag: true, AddVersionFlag: true, DefaultLogOutput: LogOutputStderr, DefaultLogLevel: LogLevelInfo, DefaultLogFormat: LogFormatText, }
Functions ¶
func GetLogLevelFromArgs ¶
func InitializeBannerOnSubCommands ¶ added in v0.3.0
func InitializeSubCommandPrinter ¶ added in v0.3.0
Types ¶
type Application ¶
type Builder ¶ added in v0.4.0
type Builder struct {
Name string
Title string
Banner string
OverrideRunE func(cmd *cobra.Command, args []string) error
ConfigureRoot func(cmd *cobra.Command)
ParseArgsFromStdin bool
PersistentFlags PersistentFlags
PersistentPreRunE []func(cmd *cobra.Command, args []string) error // collection of PreRunE functions
PersistentPostRunE []func(cmd *cobra.Command, args []string) error // collection of PostRunE functions
SubCommands []Commander
SubCommandsBannerEnabled bool
SubCommandInitializers []func(cmd *cobra.Command)
TraverseRunHooks bool
ValidArgs []string
EnableVersionCommand bool
}
func (Builder) RegisterCommand ¶ added in v0.4.0
func (Builder) RegisterCommands ¶ added in v0.4.0
func (Builder) RegisterPersistentPostRunE ¶ added in v0.4.0
func (Builder) RegisterPersistentPreRunE ¶ added in v0.4.0
type Command ¶
type LogDestination ¶ added in v0.5.4
type LogDestination string
type PersistentFlags ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.