diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 14:39:52 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | def16a1bc1c71d2fdcc7954e2ddec1384c2f05f7 (patch) | |
| tree | a84c6f05f83f12efdafb57bf9c091f840eb6e0e9 /src/exec.zig | |
| parent | 0f18cc317190c2aaaf0efec4cd6da656cb1f3402 (diff) | |
| download | pardes-def16a1bc1c71d2fdcc7954e2ddec1384c2f05f7.tar.gz pardes-def16a1bc1c71d2fdcc7954e2ddec1384c2f05f7.zip | |
Only Tty reads Word+arg as its argument
Every builtin that takes an argument split a word at its first +, so
Dump+2024.zon ran Dump with 2024.zon. A builtin now opts in with plus_arg,
read by the registry, and only Tty does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/exec.zig b/src/exec.zig index 86adfeeb..86dba32a 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -488,8 +488,12 @@ pub fn commandText(txt: []const u8) []const u8 { pub fn executeBuiltinLine(p: *Pardes, id: usize, txt: []const u8) bool { const cmd = commandText(txt); if (cmd.len == 0 or p.exec_depth >= max_exec_depth) return false; - // `Word arg`, or as one word a tag can hold, `Word+arg` (`Tty+fish`). - const sp = std.mem.indexOfAny(u8, cmd, " \t") orelse std.mem.indexOfScalar(u8, cmd, '+'); + // `Word arg`, or for a word that says so, `Word+arg` (`Tty+fish`). + const plus = std.mem.indexOfScalar(u8, cmd, '+'); + var sp = std.mem.indexOfAny(u8, cmd, " \t"); + if (sp == null) if (plus) |at| if (std.meta.stringToEnum(Builtin, cmd[0..at])) |head| { + if (builtins.registry.plusArg(head)) sp = at; + }; const bi: ?Builtin = std.meta.stringToEnum(Builtin, cmd) orelse blk: { const head = std.meta.stringToEnum(Builtin, cmd[0 .. sp orelse break :blk null]) orelse break :blk null; break :blk if (builtins.registry.takesArg(head)) head else null; |
