Documentation
¶
Index ¶
- func ApplyStyledHelpRecursive(cmd *cobra.Command)
- func Execute(cmd *cobra.Command) error
- func ExecuteContext(ctx context.Context, cmd *cobra.Command) error
- func GetLogger(cmd *cobra.Command) *logrus.Logger
- func InitConfig(configFile string) (string, error)
- func NewDocsCommand(docsJSON []byte) *cobra.Command
- func NewLogger(opts ...LoggerOption) *logrus.Logger
- func NewStandardCommand(use, short string) *cobra.Command
- func NewVersionCommand(componentName string, info VersionInfo) *cobra.Command
- func OpenBrowser(url string) error
- func PrintError(cmd *cobra.Command, err error)
- func SetStyledHelp(cmd *cobra.Command)
- func SetStyledHelpWithExtras(cmd *cobra.Command, extras HelpExtrasFunc)
- func SetVersionTemplate(cmd *cobra.Command, info VersionInfo)
- type CommandOptions
- type ErrorHandler
- type HelpExtrasFunc
- type LoggerOption
- type ProgressReporter
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyStyledHelpRecursive ¶
ApplyStyledHelpRecursive applies styled help and usage to a command and all its subcommands. Call this after all subcommands have been added, before Execute().
func Execute ¶
Execute applies styled help to all subcommands and executes the command. Use this instead of cmd.Execute() to get consistent Grove styling.
func ExecuteContext ¶
ExecuteContext applies styled help and executes the command with context. Use this instead of cmd.ExecuteContext() to get consistent Grove styling.
func InitConfig ¶
InitConfig initializes the configuration file path
func NewDocsCommand ¶
NewDocsCommand creates a standard 'docs' command that prints embedded JSON documentation.
func NewLogger ¶
func NewLogger(opts ...LoggerOption) *logrus.Logger
NewLogger creates a new logger with options
func NewStandardCommand ¶
NewStandardCommand creates a new command with standard Grove flags. After adding all subcommands, call Execute(cmd) to run with styled help.
func NewVersionCommand ¶
func NewVersionCommand(componentName string, info VersionInfo) *cobra.Command
NewVersionCommand creates a standard version command
func OpenBrowser ¶
OpenBrowser opens the specified URL in the default browser
func PrintError ¶
PrintError prints a styled error message to stderr with help hint.
func SetStyledHelp ¶
SetStyledHelp applies consistent Grove styling to a command's help output. Call this on the root command before Execute().
func SetStyledHelpWithExtras ¶
func SetStyledHelpWithExtras(cmd *cobra.Command, extras HelpExtrasFunc)
SetStyledHelpWithExtras applies Grove styling with additional custom sections. The extras function is called after COMMANDS but before the help hint.
func SetVersionTemplate ¶
func SetVersionTemplate(cmd *cobra.Command, info VersionInfo)
SetVersionTemplate sets a custom version template for a cobra command
Types ¶
type CommandOptions ¶
CommandOptions holds common options for Grove commands
func GetOptions ¶
func GetOptions(cmd *cobra.Command) CommandOptions
GetOptions extracts common options from a command
type ErrorHandler ¶
type ErrorHandler struct {
Verbose bool
}
ErrorHandler provides user-friendly error messages
func NewErrorHandler ¶
func NewErrorHandler(verbose bool) *ErrorHandler
NewErrorHandler creates a new error handler
func (*ErrorHandler) Handle ¶
func (h *ErrorHandler) Handle(err error) error
Handle provides user-friendly error messages based on error type
type HelpExtrasFunc ¶
HelpExtrasFunc is a callback that renders additional help sections. It receives the theme for consistent styling.
type LoggerOption ¶
LoggerOption represents a function that configures a logger
func WithFormatter ¶
func WithFormatter(formatter logrus.Formatter) LoggerOption
WithFormatter sets the log formatter
type ProgressReporter ¶
type ProgressReporter struct {
// contains filtered or unexported fields
}
ProgressReporter reports concurrent operation progress
func NewProgressReporter ¶
func NewProgressReporter() *ProgressReporter
NewProgressReporter creates a new progress reporter
func (*ProgressReporter) Done ¶
func (p *ProgressReporter) Done()
Done marks the operation as complete
func (*ProgressReporter) Update ¶
func (p *ProgressReporter) Update(service, status string)
Update updates the status of a service