~gpanders/wk

7c612ec6ab6ee05c10bd62e6d11f102307919505 — Greg Anders 8 months ago d89283e
Print unknown command error from parseCommand function

parseCommand is the only function that actually knows what the command
that's being parsed is, since the command could be the first argument,
i.e.

    zet CMD

or the second, when using `help`:

    zet help CMD
2 files changed, 1 insertions(+), 1 deletions(-)

M src/cmd.zig
M src/main.zig
M src/cmd.zig => src/cmd.zig +1 -0
@@ 215,6 215,7 @@ fn parseCommand(command: []const u8) !Command {
        return .Tags;
    }

    std.debug.warn("Error: unknown command: {}\n", .{command});
    return error.UnknownCommand;
}


M src/main.zig => src/main.zig +0 -1
@@ 39,7 39,6 @@ pub fn main() anyerror!void {

    cmd.handleCommand(allocator, command, args) catch |err| return switch (err) {
        error.UnknownCommand => {
            std.debug.warn("Error: unknown command: {}\n", .{command});
            std.debug.warn("Use \"zet help\" for usage.\n", .{});
            std.process.exit(1);
        },