summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:51:05 -0300
committerGabriel Schneider <[email protected]>2026-11-05 09:54:56 -0300
commitc34cfba8ab10d5cf2dc69c01d55f3e244295cc6f (patch)
treeca7c89b968d020a58da8322d9ef406b380d65f3c
parentb0a02deff23a852e6fb3d803ce85256949419af8 (diff)
downloadpardes-c34cfba8ab10d5cf2dc69c01d55f3e244295cc6f.tar.gz
pardes-c34cfba8ab10d5cf2dc69c01d55f3e244295cc6f.zip
main: --9p-quic goes (its help line, its parse and its refusals; QUIC leaves the build), and --tty-toggle and --tty-toggle=<k> are parsed by one branch; flags.zig's QUIC rows go, and quicIncluded says a pardes with no --9p-quic serves none
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
-rw-r--r--src/main.zig35
-rw-r--r--test/process/flags.zig3
2 files changed, 8 insertions, 30 deletions
diff --git a/src/main.zig b/src/main.zig
index 4b0d5220..58f9541a 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -97,8 +97,7 @@ const help_text =
\\ The socket is under $XDG_RUNTIME_DIR, falling
\\ back to ~/.local/state/pardes.
\\ --9p-tcp=<dial> also serve 9P at tcp!<numeric-ip>!<port>.
- \\ --9p-quic=<dial> also serve at quic!<numeric-ip>!<port> (-Dquic=true).
- \\ --mount=<name>=<dial> mount a 9P session or Unix/TCP/QUIC endpoint under /n/<name>.
+ \\ --mount=<name>=<dial> mount a 9P session or Unix/TCP endpoint under /n/<name>.
\\ Repeat for more mounts; os and self are reserved.
\\ --detach run this session with no terminal (no window)
\\ until one attaches; its panes, shells and files
@@ -441,18 +440,15 @@ fn nativeMain(std_init: std.process.Init) !void {
const a = args[i];
if (std.mem.eql(u8, a, "--tty")) {
explicit_tty = true;
- } else if (std.mem.startsWith(u8, a, "--tty-toggle=")) {
+ } else if (std.mem.eql(u8, a, "--tty-toggle") or std.mem.startsWith(u8, a, "--tty-toggle=")) {
session_only = false;
new_session = true;
- opts.tty_toggle = parseCtrlKey(a["--tty-toggle=".len..]) orelse
- badArgs(init.io, "--tty-toggle wants one letter, not '{s}'", .{a["--tty-toggle=".len..]});
- } else if (std.mem.eql(u8, a, "--tty-toggle")) {
- session_only = false;
- new_session = true;
- i += 1;
- if (i >= args.len) badArgs(init.io, "--tty-toggle needs a letter after it", .{});
- opts.tty_toggle = parseCtrlKey(args[i]) orelse
- badArgs(init.io, "--tty-toggle wants one letter, not '{s}'", .{args[i]});
+ const key = if (a.len > "--tty-toggle".len) a["--tty-toggle=".len..] else next: {
+ i += 1;
+ if (i >= args.len) badArgs(init.io, "--tty-toggle needs a letter after it", .{});
+ break :next args[i];
+ };
+ opts.tty_toggle = parseCtrlKey(key) orelse badArgs(init.io, "--tty-toggle wants one letter, not '{s}'", .{key});
} else if (std.mem.eql(u8, a, "-n")) {
session_only = false;
new_session = true;
@@ -485,19 +481,6 @@ fn nativeMain(std_init: std.process.Init) !void {
opts.ninep_tcp = dial;
} else if (std.mem.eql(u8, a, "--9p-tcp")) {
badArgs(init.io, "--9p-tcp needs tcp!<numeric-ip>!<port>", .{});
- } else if (std.mem.startsWith(u8, a, "--9p-quic=")) {
- new_session = true;
- const dial = a["--9p-quic=".len..];
- if (!std.mem.startsWith(u8, dial, "quic!"))
- badArgs(init.io, "--9p-quic needs quic!<numeric-ip>!<port>", .{});
- _ = @import("9p_io.zig").networkAddress(dial, true) catch
- badArgs(init.io, "--9p-quic needs quic!<numeric-ip>!<port>", .{});
- if (opts.ninep_quic != null) badArgs(init.io, "--9p-quic was specified twice", .{});
- if (!@import("9p_io.zig").quic_enabled)
- badArgs(init.io, "QUIC is not included; rebuild with -Dquic=true", .{});
- opts.ninep_quic = dial;
- } else if (std.mem.eql(u8, a, "--9p-quic")) {
- badArgs(init.io, "--9p-quic needs quic!<numeric-ip>!<port>", .{});
} else if (std.mem.startsWith(u8, a, "--mount=")) {
new_session = true;
const mount = a["--mount=".len..];
@@ -581,8 +564,6 @@ fn nativeMain(std_init: std.process.Init) !void {
badArgs(init.io, "--9p names a session's own socket, and --attach has none of its own", .{});
if (opts.ninep_tcp != null and attach != null)
badArgs(init.io, "--9p-tcp opens a session's own listener, and --attach has none of its own", .{});
- if (opts.ninep_quic != null and attach != null)
- badArgs(init.io, "--9p-quic opens a session's own listener, and --attach has none of its own", .{});
if (opts.mounts.len != 0 and attach != null)
badArgs(init.io, "--mount configures a session's own core, and --attach has none of its own", .{});
if (!new_session and !opts.nested and detach == null and attach == null and !resuming) forwarding: {
diff --git a/test/process/flags.zig b/test/process/flags.zig
index 7a1118f0..c9aa12fb 100644
--- a/test/process/flags.zig
+++ b/test/process/flags.zig
@@ -117,9 +117,6 @@ fn refusals(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
.{ &.{"--9p-tcp=quic!127.0.0.1!5640"}, "--9p-tcp needs" },
.{ &.{ "--9p-tcp=tcp!127.0.0.1!5640", "--9p-tcp=tcp!127.0.0.1!5641" }, "specified twice" },
.{ &.{ "--attach=work", "--9p-tcp=tcp!127.0.0.1!5640" }, "--attach has none" },
- .{ &.{"--9p-quic"}, "--9p-quic needs" },
- .{ &.{"--9p-quic="}, "--9p-quic needs" },
- .{ &.{"--9p-quic=tcp!127.0.0.1!5640"}, "--9p-quic needs" },
.{ &.{"--mount=os=work"}, "invalid mount name" },
.{ &.{"--mount=peer="}, "invalid mount name or dial" },
.{ &.{ "--mount=peer=one", "--mount=peer=two" }, "duplicate mount" },