Fix sdlcli get -command result stdout write
[ric-plt/sdlgo.git] / internal / cli / get.go
index de4f80c..f56c6a0 100644 (file)
@@ -43,20 +43,23 @@ func init() {
 var (
        getLong = `Display one or many resources.
 
-Prints keys and keys data in the given namespace.`
+Prints namespaces, keys or keys data in the given namespace.`
 
-       getExample = `  # Get reads keys data in the given namespace.
-  sdlcli get sdlns key1
-
-  # Get reads multiple keys data in the given namespace.
-  sdlcli get sdlns key1 key2 key3
+       getExample = `  # List all the namespaces in database.
+  sdlcli get namespaces
 
   # List keys in the given namespace.
-  sdlcli get keys sdlns`
+  sdlcli get keys sdlns
+
+  # Reads key data in the given namespace.
+  sdlcli get sdlns key1
+
+  # Read multiple keys data in the given namespace.
+  sdlcli get sdlns key1 key2 key3`
 )
 
 func newGetCmd(sdlCb SyncStorageCreateCb) *cobra.Command {
-       return &cobra.Command{
+       cmd := &cobra.Command{
                Use:     "get <namespace> <key> [<key2> <key3>... <keyN>]",
                Short:   "Display one or many resources",
                Long:    getLong,
@@ -75,6 +78,8 @@ func newGetCmd(sdlCb SyncStorageCreateCb) *cobra.Command {
                        return nil
                },
        }
+       cmd.SetOut(os.Stdout)
+       return cmd
 }
 
 func runGet(sdlCb SyncStorageCreateCb, args []string) (map[string]interface{}, error) {