Skip to content

Commit

Permalink
utils/cobrautil/templates: replace <ex> with <code>
Browse files Browse the repository at this point in the history
  • Loading branch information
Choraden authored and mmatczuk committed Mar 25, 2024
1 parent bd0e343 commit e738fe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions utils/cobrautil/templates/help_flags_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func (p *HelpFlagPrinter) PrintHelpFlag(flag *flag.Flag) {
flagStr, usageStr := flagAndUsage[0], strings.Join(flagAndUsage[1:], " ")

usageWithBreakLines := strings.ReplaceAll(usageStr, "<br>", "\n\n")
usageWithExamples := strings.ReplaceAll(usageWithBreakLines, "<ex>", "\"")
usageWithLinks := withLinks(usageWithExamples)
usageWithCodeBlocks := strings.ReplaceAll(strings.ReplaceAll(usageWithBreakLines, "<code>", "\""), "</code>", "\"")
usageWithLinks := withLinks(usageWithCodeBlocks)
wrappedUsages := wordwrap.WrapString(usageWithLinks, p.wrapLimit-offset)
wrappedStr = flagStr + "\n" + wrappedUsages
appendTabStr := strings.ReplaceAll(wrappedStr, "\n", "\n\t")
Expand Down
3 changes: 2 additions & 1 deletion utils/cobrautil/templates/markdown_flag_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ func (p *MarkdownFlagPrinter) PrintHelpFlag(f *pflag.Flag) {
body := p.body(f)
body = strings.ReplaceAll(body, ". ", ".\n")
body = strings.ReplaceAll(body, "<br>", "\n")
body = strings.ReplaceAll(body, "<ex>", "\n```\n")
body = strings.ReplaceAll(body, "<code>", "```\n")
body = strings.ReplaceAll(body, "</code>", "\n```\n")
body = withMarkdownLinks(body)

fmt.Fprintf(p.out, body)
Expand Down

0 comments on commit e738fe8

Please sign in to comment.