From ff3738b2fe8312b0a108cf7301ec99e1c4d0a24b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 16:31:13 -0300 Subject: Mini with no argument is wrong #args, EINVAL; Find, Grep and Mini say their names capitalised Mini needs a file but did not say so, so a bare Mini ran and failed EIO. It now requires its argument, refused wrong #args (EINVAL) as every such word is. Its failures, Find's and Grep's start with the builtin's own name (Mini:, Find:, Grep:), as the others' do. Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 8788e65f..4a0b107c 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1372,11 +1372,12 @@ pub const Pet = struct { /// Open a minimap of the file in braille dots. pub const Mini = struct { pub const takes_arg = true; + pub const requires_arg = true; // a file to map: bare, wrong #args (EINVAL) pub const output: OutputTraits = .{ .name = "Mini", .doc = true }; pub fn run(c: Ctx) void { panes.Mini.open(c.p, c.id, c.arg orelse "") catch |err| - c.p.reportError(c.id, "mini", err); + c.p.reportError(c.id, "Mini", err); } }; @@ -1384,8 +1385,8 @@ pub const Mini = struct { /// A Find or Grep that finds nothing fails as one, in words 9ns reads as /// ENOENT (`not found`), the same for both. -const e_search_miss_find = "find: name not found"; -const e_search_miss_grep = "grep: pattern not found"; +const e_search_miss_find = "Find: name not found"; +const e_search_miss_grep = "Grep: pattern not found"; /// List the files below this pane's directory whose names hold its argument, in a +Search. pub const Find = struct { @@ -1395,7 +1396,7 @@ pub const Find = struct { pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (pat.len > 0) { - const rows = look.runSearch(c.p, c.id, pat, .find, .top, false) catch |err| return c.p.reportError(c.id, "find", err); + const rows = look.runSearch(c.p, c.id, pat, .find, .top, false) catch |err| return c.p.reportError(c.id, "Find", err); if (rows == 0) c.p.reportFailure(c.id, e_search_miss_find); return; } @@ -1412,7 +1413,7 @@ pub const Grep = struct { pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (pat.len > 0) { - const rows = look.runSearch(c.p, c.id, pat, .grep, .top, false) catch |err| return c.p.reportError(c.id, "grep", err); + const rows = look.runSearch(c.p, c.id, pat, .grep, .top, false) catch |err| return c.p.reportError(c.id, "Grep", err); if (rows == 0) c.p.reportFailure(c.id, e_search_miss_grep); return; } -- cgit v1.3