diff options
author | Martin Treusch von Buttlar <martin.tvb@vitraum.de> | 2017-05-16 06:40:54 +0200 |
---|---|---|
committer | Martin Treusch von Buttlar <martin.tvb@vitraum.de> | 2017-05-16 06:40:54 +0200 |
commit | d89c33c1398428d4a456ca0252e6b1718efb0b96 (patch) | |
tree | 84b24ddb8ad8c651799bb4fdd04290d751b2b11d /cmd | |
parent | 8181c4f325519055d7fec9982737b0a22f175534 (diff) |
move usage examples to cobra field of same name
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ponzu/add.go | 6 | ||||
-rw-r--r-- | cmd/ponzu/build.go | 8 | ||||
-rw-r--r-- | cmd/ponzu/generate.go | 7 | ||||
-rw-r--r-- | cmd/ponzu/main.go | 16 | ||||
-rw-r--r-- | cmd/ponzu/new.go | 6 | ||||
-rw-r--r-- | cmd/ponzu/upgrade.go | 6 | ||||
-rw-r--r-- | cmd/ponzu/usage.go | 6 |
7 files changed, 21 insertions, 34 deletions
diff --git a/cmd/ponzu/add.go b/cmd/ponzu/add.go index c1242db..7832b4e 100644 --- a/cmd/ponzu/add.go +++ b/cmd/ponzu/add.go @@ -17,10 +17,8 @@ var addCmd = &cobra.Command{ Short: "Downloads addon from specified import path", Long: `Downloads addon from specified import path to $GOPATH/src and copys it to the current project's ./addons directory. Must be called from within a -Ponzu project directory. - -Example: -$ ponzu add github.com/bosssauce/fbscheduler`, +Ponzu project directory.`, + Example: `$ ponzu add github.com/bosssauce/fbscheduler`, RunE: func(cmd *cobra.Command, args []string) error { // expecting two args, add and the go gettable package uri if len(args) < 1 { diff --git a/cmd/ponzu/build.go b/cmd/ponzu/build.go index 3797e84..8760096 100644 --- a/cmd/ponzu/build.go +++ b/cmd/ponzu/build.go @@ -72,15 +72,13 @@ var buildCmd = &cobra.Command{ the necessary files from your workspace into the vendored directory, and will build/compile the project to then be run. -Example: -$ ponzu build -(or) -$ ponzu -gocmd=go1.8rc1 build - By providing the 'gocmd' flag, you can specify which Go command to build the project, if testing a different release of Go. Errors will be reported, but successful build commands return nothing.`, + Example: `$ ponzu build +(or) +$ ponzu -gocmd=go1.8rc1 build`, RunE: func(cmd *cobra.Command, args []string) error { return buildPonzuServer() }, diff --git a/cmd/ponzu/generate.go b/cmd/ponzu/generate.go index cc2b93a..fd3b77e 100644 --- a/cmd/ponzu/generate.go +++ b/cmd/ponzu/generate.go @@ -421,9 +421,6 @@ var generateCmd = &cobra.Command{ Short: "generate boilerplate code for various Ponzu components", Long: `Generate boilerplate code for various Ponzu components, such as 'content'. -Example: -$ ponzu gen content review title:"string" body:"string" rating:"int" tags:"[]string" - The command above will generate a file 'content/review.go' with boilerplate methods, as well as struct definition, and corresponding field tags like: @@ -438,10 +435,12 @@ The generate command will intelligently parse more sophisticated field names such as 'field_name' and convert it to 'FieldName' and vice versa, only where appropriate as per common Go idioms. Errors will be reported, but successful generate commands return nothing.`, + Example: `$ ponzu gen content review title:"string" body:"string" rating:"int" tags:"[]string"`, } var contentCmd = &cobra.Command{ - Use: "content <namespace> <field> <field>...", + Use: "content <namespace> <field> <field>...", + Short: "generates a new content type", RunE: func(cmd *cobra.Command, args []string) error { return generateContentType(args) }, diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index 43e9536..bfe501a 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -60,15 +60,6 @@ The segments, separated by a comma, describe which services to start, either if the server should utilize TLS encryption - served over HTTPS, which is automatically managed using Let's Encrypt (https://letsencrypt.org) -Example: -$ ponzu run -(or) -$ ponzu -port=8080 --https run admin,api -(or) -$ ponzu run admin -(or) -$ ponzu -port=8888 run api - Defaults to '-port=8080 run admin,api' (running Admin & API on port 8080, without TLS) Note: @@ -76,6 +67,13 @@ Admin and API cannot run on separate processes unless you use a copy of the database, since the first process to open it receives a lock. If you intend to run the Admin and API on separate processes, you must call them with the 'ponzu' command independently.`, + Example: `$ ponzu run +(or) +$ ponzu -port=8080 --https run admin,api +(or) +$ ponzu run admin +(or) +$ ponzu -port=8888 run api`, RunE: func(cmd *cobra.Command, args []string) error { var addTLS string if https { diff --git a/cmd/ponzu/new.go b/cmd/ponzu/new.go index 3c18a21..d5afadb 100644 --- a/cmd/ponzu/new.go +++ b/cmd/ponzu/new.go @@ -21,11 +21,9 @@ there is no local repository to clone from at the local machine's $GOPATH, 'new' will attempt to clone the 'github.com/ponzu-cms/ponzu' package from over the network. -Example: -$ ponzu new myProject -> New ponzu project created at $GOPATH/src/myProject - Errors will be reported, but successful commands return nothing.`, + Example: `$ ponzu new myProject +> New ponzu project created at $GOPATH/src/myProject`, RunE: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("project name not supplied") diff --git a/cmd/ponzu/upgrade.go b/cmd/ponzu/upgrade.go index 252a4f8..2bcbc53 100644 --- a/cmd/ponzu/upgrade.go +++ b/cmd/ponzu/upgrade.go @@ -15,10 +15,8 @@ var upgradeCmd = &cobra.Command{ Short: "upgrades your project to the current ponzu version", Long: `Will backup your own custom project code (like content, addons, uploads, etc) so if necessary. Before running '$ ponzu upgrade', you should update the 'ponzu' -package by running '$ go get -u github.com/ponzu-cms/ponzu/...' - -Example: -$ ponzu upgrade`, +package by running '$ go get -u github.com/ponzu-cms/ponzu/...'`, + Example: `$ ponzu upgrade`, RunE: func(cmd *cobra.Command, args []string) error { // confirm since upgrade will replace Ponzu core files path, err := os.Getwd() diff --git a/cmd/ponzu/usage.go b/cmd/ponzu/usage.go index 1571ad0..f5160b2 100644 --- a/cmd/ponzu/usage.go +++ b/cmd/ponzu/usage.go @@ -14,10 +14,8 @@ var versionCmd = &cobra.Command{ Use: "version", Short: "Prints the version of Ponzu your project is using.", Long: `Prints the version of Ponzu your project is using. Must be called from -within a Ponzu project directory. - -Example: -$ ponzu version +within a Ponzu project directory.`, + Example: `$ ponzu version > Ponzu v0.7.1 (or) $ ponzu --cli version |