diff --git a/cli/src/commands/dataset_hash.zig b/cli/src/commands/dataset_hash.zig deleted file mode 100644 index cf58a8e..0000000 --- a/cli/src/commands/dataset_hash.zig +++ /dev/null @@ -1,49 +0,0 @@ -const std = @import("std"); -const cli = @import("../../main.zig"); -const hash_mod = @import("../../utils/hash.zig"); -const io = @import("../../utils/io.zig"); - -pub const name = "dataset hash"; -pub const description = "Hash a dataset directory using SHA256"; - -pub fn run(allocator: std.mem.Allocator, args: []const []const u8) !void { - // Parse arguments - if (args.len < 1) { - std.debug.print("Usage: ml dataset hash \n", .{}); - std.debug.print(" Path to dataset directory\n", .{}); - return; - } - - const path = args[0]; - - // Hash the directory - io.printInfo("Hashing dataset at: {s}\n", .{path}); - - const hash = hash_mod.hashDirectoryToHex(allocator, path) catch |err| { - switch (err) { - error.PathTraversalAttempt => { - io.printError("Invalid path (path traversal detected): {s}\n", .{path}); - }, - error.NotAFile => { - io.printError("Not a regular file: {s}\n", .{path}); - }, - error.EmptyDirectory => { - io.printError("Directory is empty or contains no files: {s}\n", .{path}); - }, - error.MaxDepthExceeded => { - io.printError("Max directory depth exceeded (32): {s}\n", .{path}); - }, - error.OutOfMemory => { - io.printError("Out of memory\n", .{}); - }, - else => { - io.printError("Hash computation failed: {s}\n", .{@errorName(err)}); - }, - } - return err; - }; - defer allocator.free(hash); - - // Print result - io.printSuccess("Dataset hash: {s}\n", .{hash}); -}