package parser import "text/template" const commandHelpTemplateText = ` App: {{.App.Name}} Command Usage: {{.Name}} [OPTIONS] SubCommmands: ----------------------------------------------------------- help : Show this help output {{range .SubCommands}} {{.Name | printf "%-12s" }} : {{.Description}} {{end}} Flags: ----------------------------------------------------------- -h --help : Show this help output {{range .Flags}}{{if .Short}}{{.Short}}{{end}} {{if .Long}}{{.Long}}{{end}} : {{.Description}} {{end}} ` var commandHelpTemplate = template.Must(template.New("command_help").Parse(commandHelpTemplateText)) const appHelpTemplateText = ` App Usage: {{.Name}} [OPTIONS] Commmands: ----------------------------------------------------------- help : Show this help output {{range .Commands}} {{.Name | printf "%-12s" }} : {{.Description}} {{end}} Flags: ----------------------------------------------------------- -h --help : Show this help output {{range .Flags}}{{if .Short}}{{.Short}}{{end}}{{if .Long}} {{.Long}}{{end}} : {{.Description}} {{end}} ` var appHelpTemplate = template.Must(template.New("app_help").Parse(appHelpTemplateText))