More group formatting tweaks.

This commit is contained in:
Alec Thomas
2021-02-09 15:23:05 +11:00
parent 294d1d1717
commit abbc2dfc2c
2 changed files with 6 additions and 10 deletions
+3 -4
View File
@@ -151,8 +151,7 @@ func printNodeDetail(w *helpWriter, node *Node, hide bool) {
w.Wrap(group.Metadata.Title)
}
if group.Metadata.Description != "" {
w.Print("")
w.Wrap(group.Metadata.Description)
w.Indent().Wrap(group.Metadata.Description)
w.Print("")
}
writeFlags(w.Indent(), group.Flags)
@@ -173,8 +172,7 @@ func printNodeDetail(w *helpWriter, node *Node, hide bool) {
w.Wrap(group.Metadata.Title)
}
if group.Metadata.Description != "" {
w.Print("")
w.Wrap(group.Metadata.Description)
w.Indent().Wrap(group.Metadata.Description)
w.Print("")
}
@@ -348,6 +346,7 @@ func (h *helpWriter) Print(text string) {
*h.lines = append(*h.lines, strings.TrimRight(h.indent+text, " "))
}
// Indent returns a new helpWriter indented by two characters.
func (h *helpWriter) Indent() *helpWriter {
return &helpWriter{indent: h.indent + " ", lines: h.lines, width: h.width - 2, HelpOptions: h.HelpOptions, helpFormatter: h.helpFormatter}
}
+3 -6
View File
@@ -323,8 +323,7 @@ Flags:
--free-bool A non grouped bool flag.
Group title taken from the kong.ExplicitGroups option
A group header
A group header
--grouped-a-string=STRING A string flag grouped in A.
--grouped-a-bool A bool flag grouped in A.
@@ -337,8 +336,7 @@ Commands:
A non grouped subcommand.
Group title taken from the kong.ExplicitGroups option
A group header
A group header
one thing <arg>
subcommand thing
@@ -383,8 +381,7 @@ Flags:
--a-free-string=STRING A non grouped string flag.
Group title taken from the kong.ExplicitGroups option
A group header
A group header
--grouped-a-string=STRING A string flag grouped in A.
--grouped-a-bool A bool flag grouped in A.