fail quickly and more quietly when a single word command is attempted
This commit is contained in:
parent
461ea3f50c
commit
247673d97f
1 changed files with 5 additions and 0 deletions
|
@ -281,6 +281,11 @@ pub fn main() !u8 {
|
||||||
try stderr.print("Usage: {s} [--sentence-parse-only] [--command-parse-only] <sentence>\n", .{args[0]});
|
try stderr.print("Usage: {s} [--sentence-parse-only] [--command-parse-only] <sentence>\n", .{args[0]});
|
||||||
return 1;
|
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| {
|
const bin_dir = std.fs.selfExeDirPathAlloc(allocator) catch |err| {
|
||||||
stderr.print("Failed to get binary path: {}\n", .{err}) catch {};
|
stderr.print("Failed to get binary path: {}\n", .{err}) catch {};
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue