Fix flags usage markdown output

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-09-03 11:52:49 +02:00
parent 6cf9fa8261
commit 8a12884814
9 changed files with 17 additions and 8 deletions

View File

@@ -179,10 +179,14 @@ func mdCmdOutput(cmd *cobra.Command, old string) (string, error) {
}
name += "`"
name = mdMakeLink(name, f.Name, f, isLink)
fmt.Fprintf(b, "%s | %s |\n", name, f.Usage)
fmt.Fprintf(b, "%s | %s |\n", mdEscapePipe(name), mdEscapePipe(f.Usage))
})
fmt.Fprintln(b, "")
}
return b.String(), nil
}
func mdEscapePipe(s string) string {
return strings.ReplaceAll(s, `|`, `\|`)
}