Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CobraCommand ¶
func CobraCommand( use, short, long, buildInfo string, wrapperFunc func(context.Context, func(context.Context, *config.Config) error, *config.Config) error, businesFunc func(context.Context, *config.Config) error, ) *cobra.Command
Example ¶
businessFunc := func(ctx context.Context, cfg *config.Config) error {
fmt.Println("Running business logic")
return nil
}
wrapperFunc := func(ctx context.Context, fn func(context.Context, *config.Config) error, cfg *config.Config) error {
fmt.Println("Wrapper function called")
return fn(ctx, cfg)
}
cmd := CobraCommand(
"example",
"Example command",
"This is an example of how to use CobraCommand",
"v1.0.0",
wrapperFunc,
businessFunc,
)
fmt.Printf("Command use: %s\n", cmd.Use)
Output: Command use: example
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.