feat(docs): Include Description and UsageText in docs output (#1287)

Include Description as part of the DESCRIPTION section, and put UsageText (if it is non-zero) into the Usage subsection.
This commit is contained in:
Link Dupont
2021-07-06 20:20:47 -04:00
committed by GitHub
parent b5d4a04c7f
commit 6373f5bf65
8 changed files with 116 additions and 14 deletions

View File

@@ -86,16 +86,18 @@ var MarkdownDocTemplate = `% {{ .App.Name }} {{ .SectionNum }}
{{ if .SynopsisArgs }}
` + "```" + `
{{ range $v := .SynopsisArgs }}{{ $v }}{{ end }}` + "```" + `
{{ end }}{{ if .App.UsageText }}
{{ end }}{{ if .App.Description }}
# DESCRIPTION
{{ .App.UsageText }}
{{ .App.Description }}
{{ end }}
**Usage**:
` + "```" + `
` + "```" + `{{ if .App.UsageText }}
{{ .App.UsageText }}
{{ else }}
{{ .App.Name }} [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]
` + "```" + `
{{ end }}` + "```" + `
{{ if .GlobalArgs }}
# GLOBAL OPTIONS
{{ range $v := .GlobalArgs }}