You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2021/08/31 05:38:12 UTC

[cloudstack-cloudmonkey] branch main updated: Display output in human readable format (#95)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git


The following commit(s) were added to refs/heads/main by this push:
     new b223215  Display output in human readable format (#95)
b223215 is described below

commit b223215da8374326b2c60649b028f969a2ac2011
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Tue Aug 31 11:08:08 2021 +0530

    Display output in human readable format (#95)
---
 cmd/output.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cmd/output.go b/cmd/output.go
index f221e03..9a02369 100644
--- a/cmd/output.go
+++ b/cmd/output.go
@@ -46,7 +46,12 @@ func jsonify(value interface{}, format string) string {
 			value = string(jsonStr)
 		}
 	}
-	return fmt.Sprintf("%v", value)
+	switch value.(type) {
+	case float64, float32:
+		return fmt.Sprintf("%.f", value)
+	default:
+		return fmt.Sprintf("%v", value)
+	}
 }
 
 func printJSON(response map[string]interface{}) {