X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=internal%2Fcli%2Froot.go;h=c5cf5ac9f93796455ff5a0b7f2618f33cdb1f74c;hb=273d032db02901dba8deeb692f92ed2366dc6ee5;hp=6d20ebcf0f7a3faa184a797ff0034ae32f4fbc38;hpb=7c256b622c8fd065e91a7e289937d6e692a7eb1d;p=ric-plt%2Fsdlgo.git diff --git a/internal/cli/root.go b/internal/cli/root.go index 6d20ebc..c5cf5ac 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -23,17 +23,26 @@ 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.AddCommand(NewHealthCheckCmd()) - return cmd +} + +func Execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } }