Simplify help messages

This commit is contained in:
Harshavardhana
2015-09-01 14:54:13 -07:00
parent 6c3d920924
commit aaec806897
13 changed files with 54 additions and 88 deletions
+7 -8
View File
@@ -29,20 +29,19 @@ import (
// Set access permissions.
var accessCmd = cli.Command{
Name: "access",
Usage: "Set access permissions.",
Usage: "Set or get access permissions.",
Action: mainAccess,
CustomHelpTemplate: `Name:
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} [OPTION] PERMISSION TARGET [TARGET ...] {{if .Description}}
mc {{.Name}} set PERMISSION TARGET [TARGET ...]
mc {{.Name}} get TARGET [TARGET ...]
PERMISSION = private | readonly | public | authorized {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
{{.Description}}{{end}}
EXAMPLES:
@@ -55,7 +54,7 @@ EXAMPLES:
3. Set bucket to "authenticated" on Amazon S3 cloud storage to provide read access to IAM Authenticated Users group.
$ mc {{.Name}} set authorized https://s3.amazonaws.com/shared-authenticated
4. Set folder to world readwrite (chmod 777) on local filesystem.
4. Get bucket permissions.
$ mc {{.Name}} get https://s3.amazonaws.com/shared
`,
}
+2 -9
View File
@@ -35,14 +35,7 @@ var catCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} SOURCE [SOURCE...] {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
mc {{.Name}} SOURCE [SOURCE...]
EXAMPLES:
1. Concantenate an object from Amazon S3 cloud storage to mplayer standard input.
@@ -55,7 +48,7 @@ EXAMPLES:
$ mc {{.Name}} *.txt > newfile.txt
4. Concatenate a non english file name from Amazon S3 cloud storage.
$ mc {{.Name}} s3:andoria/本語 > /tmp/本語
$ mc {{.Name}} s3/andoria/本語 > /tmp/本語
5. Behave like operating system tool ‘cat’, used for shell aliases.
$ echo "Hello, World!" | mc --mimic cat
+5 -1
View File
@@ -46,7 +46,11 @@ var configCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}} OPERATION OPTION [ARGS...]
mc {{.Name}} add OPTION [ARGS...]
mc {{.Name}} list OPTION [ARGS...]
mc {{.Name}} remove OPTION [ARGS...]
OPTION = alias
EXAMPLES:
1. Add aliases for a URL
+6 -10
View File
@@ -41,14 +41,7 @@ var cpCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} SOURCE [SOURCE...] TARGET {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
mc {{.Name}} SOURCE [SOURCE...] TARGET
EXAMPLES:
1. Copy list of objects from local file system to Amazon S3 cloud storage.
@@ -61,10 +54,13 @@ EXAMPLES:
$ mc {{.Name}} backup/2014/... backup/2015/... https://play.minio.io:9000/archive/
4. Copy a bucket recursively from aliased Amazon S3 cloud storage to local filesystem on Windows.
$ mc {{.Name}} s3:documents/2014/... C:\backup\2014
$ mc {{.Name}} s3/documents/2014/... C:\backup\2014
5. Copy an object of non english characters to Amazon S3 cloud storage.
$ mc {{.Name}} 本語 s3:andoria/本語
$ mc {{.Name}} 本語 s3/andoria/本語
6. Copy local folder with space characters to Amazon S3 cloud storage.
$ mc {{.Name}} 'workdir/documents/May 2014...' s3/miniocloud
`,
}
+2 -9
View File
@@ -34,18 +34,11 @@ var diffCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}} FIRST SECOND {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
mc {{.Name}} FIRST SECOND
EXAMPLES:
1. Compare foo.ogg on a local filesystem with bar.ogg on Amazon AWS cloud storage.
$ mc {{.Name}} foo.ogg https://s3.amazonaws.com/jukebox/bar.ogg
$ mc {{.Name}} foo.ogg https://s3.amazonaws.com/jukebox/bar.ogg
2. Compare two different folders on a local filesystem.
$ mc {{.Name}} ~/Photos /Media/Backup/Photos
+9 -10
View File
@@ -34,14 +34,7 @@ var lsCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}} TARGET [TARGET ...] {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
mc {{.Name}} TARGET [TARGET ...]
EXAMPLES:
1. List buckets on Amazon S3 cloud storage.
@@ -60,12 +53,18 @@ EXAMPLES:
[2015-03-31 14:46:33 PDT] 15.00MiB Gowron\Khitomer Conference Details.pdf
4. List files with non english characters on Amazon S3 cloud storage.
$ mc ls s3:andoria/本...
$ mc ls s3/andoria/本...
[2015-05-19 17:21:49 PDT] 41B 本語.pdf
[2015-05-19 17:24:19 PDT] 41B 本語.txt
[2015-05-19 17:28:22 PDT] 41B 本語.md
5. Behave like operating system tool ‘ls’, used for shell aliases.
5. List files with space characters on Amazon S3 cloud storage.
$ mc ls 's3/miniocloud/Community Files/'
[2015-05-19 17:21:49 PDT] 41B 本語.pdf
[2015-05-19 17:24:19 PDT] 41B 本語.txt
[2015-05-19 17:28:22 PDT] 41B 本語.md
6. Behave like operating system tool ‘ls’, used for shell aliases.
$ mc --mimic ls
...
[2015-05-19 17:28:22 PDT] 41B 本語.md
+1 -8
View File
@@ -35,14 +35,7 @@ var mbCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}} TARGET [TARGET ...] {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
mc {{.Name}} TARGET [TARGET ...]
EXAMPLES:
1. Create a bucket on Amazon S3 cloud storage.
+6 -10
View File
@@ -41,14 +41,7 @@ var mirrorCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} SOURCE TARGET [TARGET ...] {{if .Description}}
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
mc {{.Name}} SOURCE TARGET [TARGET ...]
EXAMPLES:
1. Mirror a bucket recursively from Minio cloud storage to multiple buckets on Amazon S3 cloud storage.
@@ -58,10 +51,13 @@ EXAMPLES:
$ mc {{.Name}} backup/... https://play.minio.io:9000/archive https://s3.amazonaws.com/archive
3. Mirror a bucket from aliased Amazon S3 cloud storage to multiple folders on Windows.
$ mc {{.Name}} s3:documents/2014/... C:\backup\2014 C:\shared\volume\backup\2014
$ mc {{.Name}} s3/documents/2014/... C:\backup\2014 C:\shared\volume\backup\2014
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
$ mc {{.Name}} 本語/... s3/mylocaldocuments play/backup
5. Mirror a local folder with space characters to Amazon s3 cloud storage
$ mc {{.Name}} 'workdir/documents/Aug 2015...' s3/miniocloud
`,
}
+1 -1
View File
@@ -177,7 +177,7 @@ func (c *s3Client) Stat() (*client.Content, *probe.Error) {
objectMetadata := new(client.Content)
bucket, object := c.url2BucketAndObject()
switch {
// valid case for s3:...
// valid case for s3/...
case bucket == "" && object == "":
for bucket := range c.api.ListBuckets() {
if bucket.Err != nil {
+7 -9
View File
@@ -37,24 +37,22 @@ var sessionCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} [SESSION] {{if .Description}}
mc {{.Name}} list
mc {{.Name}} resume SESSION-ID
mc {{.Name}} clear SESSION-ID
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
SESSION-ID = $SESSION | all
EXAMPLES:
1. List sessions
$ mc {{.Name}} list
ygVIpSJs -> [2015-08-29 15:25:12 PDT] cp /usr/bin... test
2. Resume session
$ mc {{.Name}} resume [SESSION]
$ mc {{.Name}} resume ygVIpSJs
3. Clear session
$ mc {{.Name}} clear [SESSION]|[all]
$ mc {{.Name}} clear ygVIpSJs
`,
}
+5 -9
View File
@@ -38,14 +38,9 @@ var shareCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}} TARGET [DURATION=h|m|s] {{if .Description}}
mc {{.Name}} TARGET [DURATION]
DESCRIPTION:
{{.Description}}{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{ end }}
DURATION = NN[h|m|s] [DEFAULT=168h]
EXAMPLES:
1. Generate URL for sharing, with a default expiry of 7 days.
@@ -54,8 +49,9 @@ EXAMPLES:
2. Generate URL for sharing, with an expiry of 10 minutes.
$ mc {{.Name}} https://s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz 10m
3. Generate list of URLs for sharing a folder recursively, with expiration of 1 hour each.
$ mc {{.Name}} https://s3.amazonaws.com/backup... 1h
3. Generate list of URLs for sharing a folder recursively, with expiration of 5 days each.
$ mc {{.Name}} https://s3.amazonaws.com/backup... 120h
`,
}
+2 -1
View File
@@ -38,7 +38,8 @@ var updateCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}}{{if .Flags}} [ARGS...]{{end}}
mc {{.Name}} release
mc {{.Name}} experimental
EXAMPLES:
1. Check for new official releases
+1 -3
View File
@@ -35,10 +35,8 @@ var versionCmd = cli.Command{
mc {{.Name}} - {{.Usage}}
USAGE:
mc {{.Name}} {{if .Description}}
mc {{.Name}}
DESCRIPTION:
{{.Description}}{{end}}
`,
}