From 5dd30679dc4aa7edc02b8747a8195de578014dcb Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 25 Mar 2024 20:46:58 +0100 Subject: [PATCH] docs: make help output a little prettier --- src/main.zig | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.zig b/src/main.zig index e011c67..a36b5d8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -17,7 +17,7 @@ pub const application_logo = "󱞏 "; pub fn main() anyerror!void { const params = comptime clap.parseParamsComptime( \\-h, --help Display this help and exit. - \\-f, --frame-rate Set target frame rate. (default: 60) + \\-f, --frame-rate Set target frame rate. (default: 60) \\--debug-wait Wait for key press before starting UI. \\--debug-dump-on-error Dump stack traces on errors. \\--no-sleep Do not sleep the main loop when idle. @@ -26,8 +26,8 @@ pub fn main() anyerror!void { \\--restore-session Restore restart session. \\--show-input Open the input view on start. \\--show-log Open the log view on start. - \\-l, --language Force the language of the file to be opened. - \\... File to open. + \\-l, --language Force the language of the file to be opened. + \\... File to open. \\ Add + to the command line or append \\ :LINE or :LINE:COL to the file name to jump \\ to a location in the file. @@ -41,8 +41,14 @@ pub fn main() anyerror!void { const a = std.heap.c_allocator; + const parsers = comptime .{ + .num = clap.parsers.int(usize, 10), + .lang = clap.parsers.string, + .file = clap.parsers.string, + }; + var diag = clap.Diagnostic{}; - var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ + var res = clap.parse(clap.Help, ¶ms, parsers, .{ .diagnostic = &diag, .allocator = a, }) catch |err| {