X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=internal%2Fcli%2Froot.go;h=502c42bd34c4b2a9d0e5162034ec007026213609;hb=6f724aa3950cdc01246351644348fdc0f6e9ca4a;hp=6d20ebcf0f7a3faa184a797ff0034ae32f4fbc38;hpb=977a55ca96d5dba1c7f9273671747eaf9cd6f894;p=ric-plt%2Fsdlgo.git diff --git a/internal/cli/root.go b/internal/cli/root.go index 6d20ebc..502c42b 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -23,17 +23,27 @@ package cli import ( + "fmt" "github.com/spf13/cobra" + "os" ) -func NewRootCmd() *cobra.Command { - cmd := &cobra.Command{ +var rootCmd = newRootCmd() + +func newRootCmd() *cobra.Command { + return &cobra.Command{ Use: SdlCliApp, Short: "Shared Data Layer (SDL) troubleshooting command line tool", Long: `Shared Data Layer (SDL) troubleshooting command line tool`, Run: func(cmd *cobra.Command, args []string) { + cmd.Help() }, } - cmd.AddCommand(NewHealthCheckCmd()) - return cmd +} + +func Execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } }