fix tests
diff --git a/help_test.go b/help_test.go
index 1dcbe7f..dbd7a3b 100644
--- a/help_test.go
+++ b/help_test.go
@@ -215,6 +215,8 @@
.SH DESCRIPTION
This is a somewhat \fBlonger\fP description of what this does
.SH OPTIONS
+.SS Application Options
+The application options
.TP
\fB\fB\-v\fR, \fB\-\-verbose\fR\fP
Show verbose debug information
@@ -247,15 +249,18 @@
.TP
\fB\fB\-\-opt-with-choices\fR \fIchoice\fR\fP
Option with choices
+.SS Other Options
.TP
\fB\fB\-s\fR <default: \fI"some", "value"\fR>\fP
A slice of strings
.TP
\fB\fB\-\-intmap\fR <default: \fI"a:1"\fR>\fP
A map from string to int
+.SS Subgroup
.TP
\fB\fB\-\-sip.opt\fR\fP
This is a subgroup option
+.SS Subsubgroup
.TP
\fB\fB\-\-sip.sap.opt\fR\fP
This is a subsubgroup option
diff --git a/man.go b/man.go
index d05141a..0cb114e 100644
--- a/man.go
+++ b/man.go
@@ -42,8 +42,10 @@
return
}
- if group.ShortDescription != "" {
- fmt.Fprintf(wr, ".SH %s\n", group.ShortDescription)
+ // If the parent (grp) has any subgroups, display their descriptions as
+ // subsection headers similar to the output of --help.
+ if group.ShortDescription != "" && len(grp.groups) > 0 {
+ fmt.Fprintf(wr, ".SS %s\n", group.ShortDescription)
if group.LongDescription != "" {
formatForMan(wr, group.LongDescription)