diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ffca4b15c1..148f8767b9 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -23,8 +23,8 @@ }, { "ImportPath": "github.com/minio-io/cli", - "Comment": "1.2.0-100-g6d6f8d3", - "Rev": "6d6f8d3cc162bfcb60379888e2f37d73ff6a6253" + "Comment": "1.2.0-101-g1a25bbd", + "Rev": "1a25bbdce2344b0063ea0476bceb4a4adbe4492a" }, { "ImportPath": "github.com/minio-io/donut", diff --git a/Godeps/_workspace/src/github.com/minio-io/cli/command.go b/Godeps/_workspace/src/github.com/minio-io/cli/command.go index ec857b0bec..9cd628b644 100644 --- a/Godeps/_workspace/src/github.com/minio-io/cli/command.go +++ b/Godeps/_workspace/src/github.com/minio-io/cli/command.go @@ -38,6 +38,10 @@ type Command struct { HideHelp bool // Boolean to hide this command from help or completion Hide bool + // CustomHelpTemplate the text template for the command help topic. + // cli.go uses text/template to render templates. You can + // render custom help text by setting this variable. + CustomHelpTemplate string } // Invokes the command given the context, parses ctx.Args() to generate command-specific flags diff --git a/Godeps/_workspace/src/github.com/minio-io/cli/help.go b/Godeps/_workspace/src/github.com/minio-io/cli/help.go index f0224646f0..b1b5547693 100644 --- a/Godeps/_workspace/src/github.com/minio-io/cli/help.go +++ b/Godeps/_workspace/src/github.com/minio-io/cli/help.go @@ -31,7 +31,7 @@ GLOBAL OPTIONS: // The text template for the command help topic. // cli.go uses text/template to render templates. You can // render custom help text by setting this variable. -var CommandHelpTemplate = `NAME: +var DefaultCommandHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: @@ -48,7 +48,7 @@ OPTIONS: // The text template for the subcommand help topic. // cli.go uses text/template to render templates. You can // render custom help text by setting this variable. -var SubcommandHelpTemplate = `NAME: +var DefaultSubcommandHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: @@ -147,7 +147,7 @@ func ShowCommandHelp(c *Context, command string) { app.Commands = append(app.Commands, command) } } - HelpPrinter(SubcommandHelpTemplate, app) + HelpPrinter(DefaultSubcommandHelpTemplate, app) return } @@ -161,7 +161,11 @@ func ShowCommandHelp(c *Context, command string) { c0.Flags = append(c0.Flags, flag) } } - HelpPrinter(CommandHelpTemplate, c0) + if c0.CustomHelpTemplate != "" { + HelpPrinter(c0.CustomHelpTemplate, c0) + } else { + HelpPrinter(DefaultCommandHelpTemplate, c0) + } return } } diff --git a/Makefile b/Makefile index 56eb5d2641..41f6c5ad1c 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ docs-deploy: install: test-all @echo "Installing mc:" - @godep go install github.com/minio-io/mc + @godep go install -a github.com/minio-io/mc @mkdir -p $(HOME)/.minio/mc clean: diff --git a/cmd-options.go b/cmd-options.go index f5be3c5be8..b218a9b249 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -24,22 +24,70 @@ import ( var cpCmd = cli.Command{ Name: "cp", - Usage: "copy objects", - Description: `Copies a local file or dir or object or bucket to another location locally or in S3.`, + Usage: "copy objects and files", + Description: "Copy files and objects recursively between Amazon S3, Donut and Filesystem", Action: doCopyCmd, Flags: []cli.Flag{ cli.BoolFlag{ Name: "recursive, r", - Usage: "recursively crawls given directory uploads to given bucket", + Usage: "recursively crawls a given directory or bucket", }, }, + CustomHelpTemplate: `NAME: + mc {{.Name}} - {{.Usage}} + +USAGE: + mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} SOURCE TARGET [TARGET...] {{if .Description}} + +DESCRIPTION: + {{.Description}}{{end}}{{if .Flags}} + +OPTIONS: + {{range .Flags}}{{.}} + {{end}}{{ end }} +EXAMPLES: + 1. Copy an object from Amazon S3 object storage to local fileystem. + $ mc {{.Name}} https://s3.amazonaws.com/jukebox/klingon_opera_aktuh_maylotah.ogg wakeup.ogg + + 2. Copy a bucket recursive from Donut to Amazon S3 object storage + $ mc {{.Name}} --recursive donut://home/photos/burningman2011 https://s3.amazonaws.com/burningman/ + + 3. Copy a local folder to Donut and Amazon S3 object storage + $ mc {{.Name}} --recursive backup/ donut://archive/backup/ https://s3.amazonaws.com/backup/ + +`, } var lsCmd = cli.Command{ Name: "ls", - Usage: "get list of objects", - Description: `List Objects and common prefixes under a prefix or all Buckets`, + Usage: "list files and objects", + Description: `List files and objects recursively between Amazon S3, Donut and Filesystem`, Action: doListCmd, + CustomHelpTemplate: `NAME: + mc {{.Name}} - {{.Usage}} + +USAGE: + mc {{.Name}} TARGET {{if .Description}} + +DESCRIPTION: + {{.Description}}{{end}}{{if .Flags}} + +OPTIONS: + {{range .Flags}}{{.}} + {{end}}{{ end }} + +EXAMPLES: + 1. List objects on Donut storage + $ mc {{.Name}} donut://archive/backup/ + 2015-03-28 12:47:50 PDT 51.00 MB 2006-Jan-1/backup.tar.gz + 2015-03-31 14:46:33 PDT 55.00 MB 2006-Mar-1/backup.tar.gz + + 2. List buckets on Amazon S3 object storage + $ mc {{.Name}} https://s3.amazonaws.com/ + 2015-01-20 15:42:00 PST rom + 2015-01-15 00:05:40 PST zek + +`, } var mbCmd = cli.Command{