Add global flags to all commands and subcommands (#2605)

This commit is contained in:
Anis Elleuch
2016-09-01 23:12:49 +01:00
committed by Harshavardhana
parent ff99392102
commit 3e284162d7
9 changed files with 62 additions and 40 deletions
+11 -1
View File
@@ -25,15 +25,25 @@ var versionCmd = cli.Command{
Name: "version",
Usage: "Print version.",
Action: mainVersion,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
minio {{.Name}} - {{.Usage}}
USAGE:
minio {{.Name}} {{if .Description}}
minio {{.Name}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}
`,
}
func mainVersion(ctx *cli.Context) {
if len(ctx.Args()) != 0 {
cli.ShowCommandHelpAndExit(ctx, "version", 1)
}
console.Println("Version: " + Version)
console.Println("Release-Tag: " + ReleaseTag)
console.Println("Commit-ID: " + CommitID)