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