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 2018/04/13 18:38:13 UTC
[cloudstack-cloudmonkey] branch master updated: docs: display
better formatted help with 80char width
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git
The following commit(s) were added to refs/heads/master by this push:
new fa6d97b docs: display better formatted help with 80char width
fa6d97b is described below
commit fa6d97b6c1316da84487cc185448050feacb30fd
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Sat Apr 14 00:07:39 2018 +0530
docs: display better formatted help with 80char width
Signed-off-by: Rohit Yadav <ro...@apache.org>
---
README.md | 2 +-
cmd/api.go | 17 ++++++++++++++---
cmd/help.go | 9 +++------
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 6a4d002..d1bfd54 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## CloudMonkey
+## CloudMonkey [![Build Status](https://travis-ci.org/apache/cloudstack-cloudmonkey.svg?branch=master)](https://travis-ci.org/apache/cloudstack-cloudmonkey)
`cloudmonkey` :cloud::monkey_face: is a command line interface (CLI) for
[Apache CloudStack](http://cloudstack.apache.org).
diff --git a/cmd/api.go b/cmd/api.go
index 727c3d9..ad51753 100644
--- a/cmd/api.go
+++ b/cmd/api.go
@@ -52,16 +52,27 @@ func init() {
}
if strings.Contains(strings.Join(apiArgs, " "), "-h") {
- fmt.Println("=== Help docs ===")
fmt.Printf("\033[34m%s\033[0m [async=%v] %s\n", api.Name, api.Async, api.Description)
if len(api.RequiredArgs) > 0 {
fmt.Println("Required params:", strings.Join(api.RequiredArgs, ", "))
}
if len(api.Args) > 0 {
- fmt.Println("API params:")
+ fmt.Printf("%-24s %-8s %s\n", "API Params", "Type", "Description")
+ fmt.Printf("%-24s %-8s %s\n", "==========", "====", "===========")
}
for _, arg := range api.Args {
- fmt.Printf("\033[35m%-24s\033[0m \033[36m%-12s\033[0m %s\n", arg.Name, arg.Type, arg.Description)
+ fmt.Printf("\033[35m%-24s\033[0m \033[36m%-8s\033[0m ", arg.Name, arg.Type)
+ info := []rune(arg.Description)
+ for i, r := range info {
+ fmt.Printf("%s", string(r))
+ if i > 0 && i%45 == 0 {
+ fmt.Println()
+ for i := 0; i < 34; i++ {
+ fmt.Printf(" ")
+ }
+ }
+ }
+ fmt.Println()
}
return nil
}
diff --git a/cmd/help.go b/cmd/help.go
index e26dc79..d038522 100644
--- a/cmd/help.go
+++ b/cmd/help.go
@@ -17,10 +17,6 @@
package cmd
-import (
- "fmt"
-)
-
func init() {
AddCommand(&Command{
Name: "help",
@@ -30,8 +26,9 @@ func init() {
PrintUsage()
return nil
}
- fmt.Println("FIXME: add cmd help docs")
- return nil
+ //TODO: check it's not other commands?
+ r.Args = append(r.Args, "-h")
+ return apiCommand.Handle(r)
},
})
}
--
To stop receiving notification emails like this one, please contact
rohit@apache.org.