From ed8a1276da5993fb29d77a70b131d81d0b592bbf Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 7 Aug 2024 20:31:38 +0200 Subject: [PATCH] feat: suppress some unhelpful errors --- src/tui/command.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tui/command.zig b/src/tui/command.zig index 38f7974..9d620ca 100644 --- a/src/tui/command.zig +++ b/src/tui/command.zig @@ -124,8 +124,17 @@ pub fn get_id_cache(name: []const u8, id: *?ID) ?ID { return null; } +const suppressed_errors = .{ + "enable_fast_scroll", + "disable_fast_scroll", + "clear_diagnostics", +}; + pub fn executeName(name: []const u8, ctx: Context) tp.result { - return execute(getId(name) orelse return tp.exit_fmt("CommandNotFound: {s}", .{name}), ctx); + const id = getId(name); + if (id) |id_| return execute(id_, ctx); + inline for (suppressed_errors) |err| if (std.mem.eql(u8, err, name)) return; + return tp.exit_fmt("CommandNotFound: {s}", .{name}); } fn CmdDef(comptime T: type) type {