commit 337e579ccc4d91f7be4646cd4759312b65ee331b
parent 2b3d504cd55d3d0376fe3af1b46291fd5e5c5c0a
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 11 Mar 2021 12:29:54 -0500
getopt: print summary before usage
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/getopt/getopts.ha b/getopt/getopts.ha
@@ -226,13 +226,12 @@ export fn print_usage(s: *io::stream, name: str, help: []help) void = {
// Prints command help to the provided stream.
export fn print_help(s: *io::stream, name: str, help: []help) void = {
- print_usage(s, name, help);
- fmt::fprintln(s);
-
if (help[0] is cmd_help) {
- fmt::fprintfln(s, "{}: {}", name, help[0] as cmd_help: str);
+ fmt::fprintfln(s, "{}: {}\n", name, help[0] as cmd_help: str);
};
+ print_usage(s, name, help);
+
fmt::fprint(s, "\n");
for (let i = 0z; i < len(help); i += 1) match (help[i]) {