Reformatting usage message to look more like docker's

Signed-off-by: Dave Henderson <Dave.Henderson@ca.ibm.com>
This commit is contained in:
Dave Henderson 2015-04-28 12:31:39 -04:00
parent c247c7ee9b
commit d9ae6dd871
1 changed files with 21 additions and 0 deletions

21
main.go
View File

@ -12,6 +12,26 @@ import (
"github.com/docker/machine/version" "github.com/docker/machine/version"
) )
var AppHelpTemplate = `
Usage: {{.Name}} {{if .Flags}}[OPTIONS] {{end}}COMMAND [arg...]
{{.Usage}}
Version: {{.Version}}{{if or .Author .Email}}
Author:{{if .Author}}
{{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
{{.Email}}{{end}}{{end}}
{{if .Flags}}
Options:
{{range .Flags}}{{.}}
{{end}}{{end}}
Commands:
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}
Run '{{.Name}} COMMAND --help' for more information on a command.
`
func main() { func main() {
for _, f := range os.Args { for _, f := range os.Args {
if f == "-D" || f == "--debug" || f == "-debug" { if f == "-D" || f == "--debug" || f == "-debug" {
@ -20,6 +40,7 @@ func main() {
} }
} }
cli.AppHelpTemplate = AppHelpTemplate
app := cli.NewApp() app := cli.NewApp()
app.Name = path.Base(os.Args[0]) app.Name = path.Base(os.Args[0])
app.Author = "Docker Machine Contributors" app.Author = "Docker Machine Contributors"