fix(cli): remove unreachable code and unused Command enum
- Fix duplicate 'i' case in Command.fromString that was unreachable - Remove unused Command enum entirely (dispatch uses inline comparisons) - Build verified: zig build --release=fast
This commit is contained in:
parent
1597c20b73
commit
9517271bbb
1 changed files with 0 additions and 41 deletions
|
|
@ -1,47 +1,6 @@
|
|||
const std = @import("std");
|
||||
const colors = @import("utils/colors.zig");
|
||||
|
||||
// Optimized command dispatch
|
||||
const Command = enum {
|
||||
jupyter,
|
||||
init,
|
||||
sync,
|
||||
requeue,
|
||||
queue,
|
||||
status,
|
||||
monitor,
|
||||
cancel,
|
||||
prune,
|
||||
watch,
|
||||
dataset,
|
||||
experiment,
|
||||
validate,
|
||||
info,
|
||||
unknown,
|
||||
|
||||
fn fromString(str: []const u8) Command {
|
||||
if (str.len == 0) return .unknown;
|
||||
|
||||
// Fast path for common commands
|
||||
switch (str[0]) {
|
||||
'j' => if (std.mem.eql(u8, str, "jupyter")) return .jupyter,
|
||||
'i' => if (std.mem.eql(u8, str, "init")) return .init,
|
||||
'i' => if (std.mem.eql(u8, str, "info")) return .info,
|
||||
's' => if (std.mem.eql(u8, str, "sync")) return .sync else if (std.mem.eql(u8, str, "status")) return .status,
|
||||
'q' => if (std.mem.eql(u8, str, "queue")) return .queue,
|
||||
'm' => if (std.mem.eql(u8, str, "monitor")) return .monitor,
|
||||
'c' => if (std.mem.eql(u8, str, "cancel")) return .cancel,
|
||||
'p' => if (std.mem.eql(u8, str, "prune")) return .prune,
|
||||
'w' => if (std.mem.eql(u8, str, "watch")) return .watch,
|
||||
'd' => if (std.mem.eql(u8, str, "dataset")) return .dataset,
|
||||
'e' => if (std.mem.eql(u8, str, "experiment")) return .experiment,
|
||||
'v' => if (std.mem.eql(u8, str, "validate")) return .validate,
|
||||
else => return .unknown,
|
||||
}
|
||||
return .unknown;
|
||||
}
|
||||
};
|
||||
|
||||
pub fn main() !void {
|
||||
// Initialize colors based on environment
|
||||
colors.initColors();
|
||||
|
|
|
|||
Loading…
Reference in a new issue