mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterl...@apache.org
Subject incubator-mynewt-newt git commit: add return code handling for stats
Date Wed, 20 Jan 2016 06:41:50 GMT
Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/master fa9035e1c -> 575118af5


add return code handling for stats


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/575118af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/575118af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/575118af

Branch: refs/heads/master
Commit: 575118af562945f89b1ae4fcc3079b63c396d5b0
Parents: fa9035e
Author: Sterling Hughes <sterling@apache.org>
Authored: Tue Jan 19 22:41:46 2016 -0800
Committer: Sterling Hughes <sterling@apache.org>
Committed: Tue Jan 19 22:41:46 2016 -0800

----------------------------------------------------------------------
 newtmgr/newtmgr.go        | 9 ++++++---
 newtmgr/protocol/stats.go | 5 +++--
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/575118af/newtmgr/newtmgr.go
----------------------------------------------------------------------
diff --git a/newtmgr/newtmgr.go b/newtmgr/newtmgr.go
index 3e86179..e5a7a53 100644
--- a/newtmgr/newtmgr.go
+++ b/newtmgr/newtmgr.go
@@ -286,9 +286,12 @@ func statsRunCmd(cmd *cobra.Command, args []string) {
 		nmUsage(cmd, err)
 	}
 
-	fmt.Printf("Stats Name: %s\n", srr.Name)
-	for k, v := range srrsp.Fields {
-		fmt.Printf("  %s: %d\n", k, int(v.(float64)))
+	fmt.Printf("Return Code = %d\n", srrsp.ReturnCode)
+	if srrsp.ReturnCode == 0 {
+		fmt.Printf("Stats Name: %s\n", srrsp.Name)
+		for k, v := range srrsp.Fields {
+			fmt.Printf("  %s: %d\n", k, int(v.(float64)))
+		}
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/575118af/newtmgr/protocol/stats.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/stats.go b/newtmgr/protocol/stats.go
index c1401fe..bb8d6a6 100644
--- a/newtmgr/protocol/stats.go
+++ b/newtmgr/protocol/stats.go
@@ -35,8 +35,9 @@ type StatsReadReq struct {
 }
 
 type StatsReadRsp struct {
-	Name   string                 `json:"n"`
-	Fields map[string]interface{} `json:"f"`
+	ReturnCode int                    `json:"r"`
+	Name       string                 `json:"n"`
+	Fields     map[string]interface{} `json:"f"`
 }
 
 func NewStatsReadReq() (*StatsReadReq, error) {


Mime
View raw message