mirror of https://github.com/docker/docs.git
Reformatting usage message to look more like docker's
Signed-off-by: Dave Henderson <Dave.Henderson@ca.ibm.com>
This commit is contained in:
parent
c247c7ee9b
commit
d9ae6dd871
21
main.go
21
main.go
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue