From cbc9d96d508c3042544514aede7ca0e6036a9782 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 25 Aug 2015 20:09:50 -0700 Subject: [PATCH] Format help for all commands --- access-main.go | 1 - cat-main.go | 1 - cp-main.go | 1 - diff-main.go | 1 - ls-main.go | 1 - mirror-main.go | 1 - session-main.go | 1 - share-main.go | 1 - update-main.go | 5 ++--- version-main.go | 13 +++++-------- 10 files changed, 7 insertions(+), 19 deletions(-) diff --git a/access-main.go b/access-main.go index 6b127d90..7e5901b4 100644 --- a/access-main.go +++ b/access-main.go @@ -58,7 +58,6 @@ EXAMPLES: 4. Set folder to world readwrite (chmod 777) on local filesystem. $ mc {{.Name}} public /shared/Music - `, } diff --git a/cat-main.go b/cat-main.go index 1886cafd..62b01c94 100644 --- a/cat-main.go +++ b/cat-main.go @@ -60,7 +60,6 @@ EXAMPLES: 5. Behave like operating system tool ‘cat’, used for shell aliases. $ echo "Hello, World!" | mc --mimic cat Hello, World! - `, } diff --git a/cp-main.go b/cp-main.go index 379f89b8..acb805f0 100644 --- a/cp-main.go +++ b/cp-main.go @@ -65,7 +65,6 @@ EXAMPLES: 5. Copy an object of non english characters to Amazon S3 cloud storage. $ mc {{.Name}} 本語 s3:andoria/本語 - `, } diff --git a/diff-main.go b/diff-main.go index 83b07bdc..f9d5324f 100644 --- a/diff-main.go +++ b/diff-main.go @@ -49,7 +49,6 @@ EXAMPLES: 2. Compare two different folders on a local filesystem. $ mc {{.Name}} ~/Photos /Media/Backup/Photos - `, } diff --git a/ls-main.go b/ls-main.go index 9c23e5e9..2d7aea68 100644 --- a/ls-main.go +++ b/ls-main.go @@ -69,7 +69,6 @@ EXAMPLES: $ mc --mimic ls ... [2015-05-19 17:28:22 PDT] 41B 本語.md - `, } diff --git a/mirror-main.go b/mirror-main.go index 31df457b..80d0e951 100644 --- a/mirror-main.go +++ b/mirror-main.go @@ -62,7 +62,6 @@ EXAMPLES: 4. Mirror a local folder of non english character recursively to Amazon s3 cloud storage and Minio cloud storage. $ mc {{.Name}} 本語/... s3:mylocaldocuments play:backup - `, } diff --git a/session-main.go b/session-main.go index 9484a3b3..82f08639 100644 --- a/session-main.go +++ b/session-main.go @@ -55,7 +55,6 @@ EXAMPLES: 3. Clear session $ mc {{.Name}} clear [SESSION]|[all] - `, } diff --git a/share-main.go b/share-main.go index bf69c798..f6938e99 100644 --- a/share-main.go +++ b/share-main.go @@ -59,7 +59,6 @@ EXAMPLES: 3. Generate list of URLs for sharing a folder recursively, with expiration of 1 hour each. $ mc {{.Name}} https://s3.amazonaws.com/backup... 1h - `, } diff --git a/update-main.go b/update-main.go index 876a9b13..257d68d2 100644 --- a/update-main.go +++ b/update-main.go @@ -42,11 +42,10 @@ USAGE: EXAMPLES: 1. Check for new official releases - $ mc update release + $ mc {{.Name}} release 2. Check for new experimental releases - $ mc update experimental - + $ mc {{.Name}} experimental `, } diff --git a/version-main.go b/version-main.go index 9e9c13c4..422c5580 100644 --- a/version-main.go +++ b/version-main.go @@ -38,17 +38,14 @@ USAGE: mc {{.Name}} {{if .Description}} DESCRIPTION: - {{.Description}}{{end}}{{if .Flags}} - -FLAGS: - {{range .Flags}}{{.}} - {{end}}{{ end }} - -EXAMPLES: + {{.Description}}{{end}} `, } -func mainVersion(ctxx *cli.Context) { +func mainVersion(ctx *cli.Context) { + if ctx.Args().First() == "help" { + cli.ShowCommandHelpAndExit(ctx, "version", 1) // last argument is exit code + } t, _ := time.Parse(time.RFC3339Nano, Version) if t.IsZero() { console.Println("")