+
+ # Generate a manpage stub from `self`
+ fun stub_man_options do
+ var lines = tool_description.split("\n")
+ var name = sys.program_name.basename
+ var syn = lines.shift
+ print "# NAME"
+ print ""
+ if lines.not_empty then
+ printn "{name} - "
+ print lines.join("\n")
+ print ""
+ end
+ print "# SYNOPSIS"
+ print ""
+ print syn.replace("Usage: ", "")
+ print ""
+ print "# OPTIONS"
+ for o in opts.options do
+ if o.hidden then continue
+
+ var first = true
+ print ""
+ printn "### "
+ for n in o.names do
+ if first then first = false else printn ", "
+ printn "`{n}`"
+ end
+ print ""
+ print "{o.helptext}."
+ end
+ exit 0
+ end