summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 16:31:13 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitff3738b2fe8312b0a108cf7301ec99e1c4d0a24b (patch)
tree1b58630c8d1b41ea451c45842e5c82b566ebba71 /src/builtins.zig
parent8496759196e88e4fbd25ce19d3b04722c8f25f64 (diff)
downloadpardes-ff3738b2fe8312b0a108cf7301ec99e1c4d0a24b.tar.gz
pardes-ff3738b2fe8312b0a108cf7301ec99e1c4d0a24b.zip
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 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig11
1 files changed, 6 insertions, 5 deletions
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;
}