From 36fe45e3a4a7ce9b61ab7bf2df07f0132a9170c1 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 04:58:25 -0300 Subject: `--` ends pardes's options: `pardes -- -dash.txt` opens the file named -dash.txt It said `no such option: --`. What follows `--` is a name, one at most, as for any other positional. Co-Authored-By: Claude Opus 5.5 --- src/main.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index de501047..a7d354b5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -520,6 +520,15 @@ fn nativeMain(init: std.process.Init) !void { } else if (std.mem.eql(u8, a, "--version")) { try std.Io.File.stdout().writeStreamingAll(init.io, version_text); return; + } else if (std.mem.eql(u8, a, "--")) { + // The end of options: what follows is a name, `-dash.txt` too. + for (args[i + 1 ..]) |name| { + if (name.len == 0) badArgs(init.io, "an empty argument names nothing", .{}); + if (positional != null) badArgs(init.io, "one file or directory at a time, and '{s}' is the second", .{name}); + session_only = false; + positional = name; + } + break; } else if (a.len > 0 and (a[0] != '-' or std.mem.eql(u8, a, "-")) and positional == null) { // `-` is stdin, as for cat and vim: a text to show. session_only = false; -- cgit v1.3