summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 04:58:25 -0300
committerGabriel Schneider <[email protected]>2026-10-01 04:58:26 -0300
commit36fe45e3a4a7ce9b61ab7bf2df07f0132a9170c1 (patch)
tree7c2dd36427e170e05b880666b2c8f5f3d4f108d5 /src
parent0c3cf0628adf9e22270b09d9c451b08ac07f558a (diff)
downloadpardes-36fe45e3a4a7ce9b61ab7bf2df07f0132a9170c1.tar.gz
pardes-36fe45e3a4a7ce9b61ab7bf2df07f0132a9170c1.zip
`--` 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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/main.zig9
1 files changed, 9 insertions, 0 deletions
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;