Made change

This commit is contained in:
Tristan Ancelet
2026-02-27 14:47:12 -06:00
commit ff579dba44
11 changed files with 794 additions and 0 deletions

40
templates.go Normal file
View File

@@ -0,0 +1,40 @@
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))