fail quickly and more quietly when a single word command is attempted

This commit is contained in:
Emil Lerch 2025-10-09 11:57:16 -07:00
parent 461ea3f50c
commit 247673d97f
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -281,6 +281,11 @@ pub fn main() !u8 {
try stderr.print("Usage: {s} [--sentence-parse-only] [--command-parse-only] <sentence>\n", .{args[0]});
return 1;
}
if (sentence_parse_only == .none and std.mem.count(u8, sentence_arg.?, " ") == 0) {
// a command cannot be made from a single word
try stdout.print("Ignoring attempt at single word command\n", .{});
return 0;
}
const bin_dir = std.fs.selfExeDirPathAlloc(allocator) catch |err| {
stderr.print("Failed to get binary path: {}\n", .{err}) catch {};
return 1;