Rework flag categories a bit

with internal maps instead of slices and slightly less public API
surface area
This commit is contained in:
2022-04-30 08:59:50 -04:00
parent ddac788d85
commit 156eaafb22
5 changed files with 123 additions and 93 deletions

View File

@@ -25,8 +25,8 @@ COMMANDS:{{range .VisibleCategories}}{{if .Name}}
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlagCategories}}
GLOBAL OPTIONS:{{range .VisibleFlagCategories}}
{{.Name}}
{{range .VisibleFlags}}{{.}}
{{if .Name}}{{.Name}}
{{end}}{{range .Flags}}{{.}}
{{end}}{{end}}{{else}}{{if .VisibleFlags}}
GLOBAL OPTIONS:
@@ -53,8 +53,8 @@ DESCRIPTION:
{{.Description | nindent 3 | trim}}{{end}}{{if .VisibleFlagCategories}}
OPTIONS:{{range .VisibleFlagCategories}}
{{.Name}}
{{range .VisibleFlags}}{{.}}
{{if .Name}}{{.Name}}
{{end}}{{range .Flags}}{{.}}
{{end}}{{end}}{{else}}{{if .VisibleFlags}}
OPTIONS: