use new app.ExtraInfo inside minio and donut commands properly

This commit is contained in:
Harshavardhana
2015-07-24 23:55:18 -07:00
parent 8346cc74db
commit 0eefbdef0c
5 changed files with 27 additions and 16 deletions

View File

@@ -149,7 +149,6 @@ func main() {
// set up app
app := cli.NewApp()
app.Action = runMkdonut
app.Name = "donut"
app.Version = getVersion()
app.Compiled = getVersion()
@@ -158,11 +157,15 @@ func main() {
app.Commands = commands
app.Flags = flags
app.Before = func(c *cli.Context) error {
if c.GlobalBool("debug") {
app.ExtraInfo = getSystemData()
}
globalDebugFlag = c.GlobalBool("debug")
return nil
}
app.ExtraInfo = func() map[string]string {
if globalDebugFlag {
return getSystemData()
}
return make(map[string]string)
}
app.CustomAppHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
@@ -175,7 +178,7 @@ GLOBAL FLAGS:
VERSION:
{{if .Compiled}}
{{.Compiled}}{{end}}
{{range $key, $value := .ExtraInfo}}
{{range $key, $value := ExtraInfo}}
{{$key}}:
{{$value}}
{{end}}