Show usage options in help string

This commit is contained in:
Gyepi Sam 2013-05-20 16:27:15 -04:00
parent 3c6b6c35c4
commit 1cae7f2834

10
main.go
View File

@ -45,15 +45,21 @@ func main() {
}
func usage() {
fmt.Print(usagePrefix)
flag.PrintDefaults()
usageTmpl.Execute(os.Stdout, commands)
}
var usageTmpl = template.Must(template.New("usage").Parse(
`goose is a database migration management system for Go projects.
var usagePrefix = `
goose is a database migration management system for Go projects.
Usage:
goose [options] <subcommand> [subcommand options]
Options:
`
var usageTmpl = template.Must(template.New("usage").Parse(
`
Commands:{{range .}}
{{.Name | printf "%-10s"}} {{.Summary}}{{end}}
`))