From: Timo Tietavainen Date: Thu, 30 Dec 2021 10:40:57 +0000 (+0200) Subject: Fix sdlcli get -command result stdout write X-Git-Tag: v0.9.3^0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=7e262d4f4e530aec98903e99b195d9e2d07dbcb0;p=ric-plt%2Fsdlgo.git Fix sdlcli get -command result stdout write Sdlcli get -command writes wrongly results to stderr stream. Fix sdlcli get -command to write results to stdout stream when command execution has succeeded. In addition add similar stdout redirect also to sdlcli statistics -command just to keep the code look the same, even thought there wasn't any real issue with sdlcli statistics -command's results visibility. Version: 0.9.3 Issue-Id: RIC-873 Signed-off-by: Timo Tietavainen Change-Id: Icc7d42d9200bdcc74bf1da6ceab341dd6b69c16e --- diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 6a1074b..c5bc735 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -29,6 +29,10 @@ This document provides the release notes of the sdlgo. Version history --------------- +[0.9.3] - 2021-12-30 + +* Fix SDL CLI get -command to write results stdout stream when command success + [0.9.2] - 2021-12-22 * Fix SDL CLI healthcheck to ignore ghost Redis Sentinel entries diff --git a/internal/cli/get.go b/internal/cli/get.go index f22ae73..f56c6a0 100644 --- a/internal/cli/get.go +++ b/internal/cli/get.go @@ -59,7 +59,7 @@ Prints namespaces, keys or keys data in the given namespace.` ) func newGetCmd(sdlCb SyncStorageCreateCb) *cobra.Command { - return &cobra.Command{ + cmd := &cobra.Command{ Use: "get [ ... ]", Short: "Display one or many resources", Long: getLong, @@ -78,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) { diff --git a/internal/cli/keys.go b/internal/cli/keys.go index c656542..214dc97 100644 --- a/internal/cli/keys.go +++ b/internal/cli/keys.go @@ -59,7 +59,7 @@ var ( ) func newKeysCmd(sdlCb SyncStorageCreateCb) *cobra.Command { - return &cobra.Command{ + cmd := &cobra.Command{ Use: "keys [pattern|default '*']", Short: "List keys in the given namespace matching key search pattern", Long: keysLong, @@ -83,6 +83,8 @@ func newKeysCmd(sdlCb SyncStorageCreateCb) *cobra.Command { return nil }, } + cmd.SetOut(os.Stdout) + return cmd } func runListKeys(sdlCb SyncStorageCreateCb, args keysArgs) ([]string, error) { diff --git a/internal/cli/statistics.go b/internal/cli/statistics.go index 05608e2..b247fc2 100644 --- a/internal/cli/statistics.go +++ b/internal/cli/statistics.go @@ -43,7 +43,7 @@ var ( ) func newStatisticsCmd(dbCreateCb DbCreateCb) *cobra.Command { - return &cobra.Command{ + cmd := &cobra.Command{ Use: "statistics", Short: "Display statistics.", Long: statsLong, @@ -59,6 +59,8 @@ func newStatisticsCmd(dbCreateCb DbCreateCb) *cobra.Command { return nil }, } + cmd.SetOut(os.Stdout) + return cmd } func runStats(dbCreateCb DbCreateCb) ([]*sdlgoredis.DbStatistics, error) {