diff --git a/internal/command.go b/internal/command.go index 51d4ca3b89..b8a24d37b8 100644 --- a/internal/command.go +++ b/internal/command.go @@ -26,6 +26,7 @@ import ( "github.com/confluentinc/cli/v4/internal/connect" "github.com/confluentinc/cli/v4/internal/context" ccl "github.com/confluentinc/cli/v4/internal/custom-code-logging" + idebug "github.com/confluentinc/cli/v4/internal/debug" "github.com/confluentinc/cli/v4/internal/environment" "github.com/confluentinc/cli/v4/internal/feedback" "github.com/confluentinc/cli/v4/internal/flink" @@ -117,6 +118,7 @@ func NewConfluentCommand(cfg *config.Config) *cobra.Command { cmd.AddCommand(configuration.New(cfg, prerunner)) cmd.AddCommand(connect.New(cfg, prerunner)) cmd.AddCommand(context.New(prerunner)) + cmd.AddCommand(idebug.New(prerunner)) cmd.AddCommand(environment.New(prerunner)) cmd.AddCommand(feedback.New(prerunner)) cmd.AddCommand(flink.New(cfg, prerunner)) diff --git a/internal/debug/command.go b/internal/debug/command.go new file mode 100644 index 0000000000..41f419a2aa --- /dev/null +++ b/internal/debug/command.go @@ -0,0 +1,25 @@ +package debug + +import ( + "github.com/spf13/cobra" + + pcmd "github.com/confluentinc/cli/v4/pkg/cmd" +) + +type command struct { + *pcmd.CLICommand +} + +func New(prerunner pcmd.PreRunner) *cobra.Command { + cmd := &cobra.Command{ + Use: "debug", + Short: "Debug utilities for internal testing.", + Hidden: true, + } + + c := &command{CLICommand: pcmd.NewAnonymousCLICommand(cmd, prerunner)} + + cmd.AddCommand(c.newPanicCommand()) + + return cmd +} diff --git a/internal/debug/command_panic.go b/internal/debug/command_panic.go new file mode 100644 index 0000000000..362d730cc7 --- /dev/null +++ b/internal/debug/command_panic.go @@ -0,0 +1,19 @@ +package debug + +import ( + "github.com/spf13/cobra" +) + +func (c *command) newPanicCommand() *cobra.Command { + return &cobra.Command{ + Use: "panic", + Short: "Trigger a test panic for crash reporting validation.", + Long: "Trigger a test panic to validate the crash reporting pipeline; note that panic traces are only collected and reported when logged in to Confluent Cloud.", + Args: cobra.NoArgs, + RunE: c.panic, + } +} + +func (c *command) panic(_ *cobra.Command, _ []string) error { + panic("test panic") +}