diff --git a/cli/src/commands/prune.zig b/cli/src/commands/prune.zig index 8c9eeb4..3a16f76 100644 --- a/cli/src/commands/prune.zig +++ b/cli/src/commands/prune.zig @@ -2,7 +2,7 @@ const std = @import("std"); const Config = @import("../config.zig").Config; const ws = @import("../net/ws/client.zig"); const crypto = @import("../utils/crypto.zig"); -const logging = @import("../utils/logging.zig"); +const io = @import("../utils/io.zig"); const core = @import("../core.zig"); pub fn run(allocator: std.mem.Allocator, args: []const []const u8) !void { @@ -42,19 +42,19 @@ pub fn run(allocator: std.mem.Allocator, args: []const []const u8) !void { // Add confirmation prompt if (!flags.flags.json) { if (keep_count) |count| { - if (!logging.confirm("This will permanently delete all but the {d} most recent experiments. Continue?", .{count})) { - logging.info("Prune cancelled.\n", .{}); + if (!io.confirm("This will permanently delete all but the {d} most recent experiments. Continue?", .{count})) { + io.info("Prune cancelled.\n", .{}); return; } } else if (older_than_days) |days| { - if (!logging.confirm("This will permanently delete all experiments older than {d} days. Continue?", .{days})) { - logging.info("Prune cancelled.\n", .{}); + if (!io.confirm("This will permanently delete all experiments older than {d} days. Continue?", .{days})) { + io.info("Prune cancelled.\n", .{}); return; } } } - logging.info("Pruning experiments...\n", .{}); + io.info("Pruning experiments...\n", .{}); // Use plain password for WebSocket authentication, hash for binary protocol const api_key_plain = config.api_key; // Plain password from config @@ -75,12 +75,12 @@ pub fn run(allocator: std.mem.Allocator, args: []const []const u8) !void { if (keep_count) |count| { prune_type = 0; // keep N value = count; - logging.info("Keeping {d} most recent experiments\n", .{count}); + io.info("Keeping {d} most recent experiments\n", .{count}); } if (older_than_days) |days| { prune_type = 1; // older than days value = days; - logging.info("Removing experiments older than {d} days\n", .{days}); + io.info("Removing experiments older than {d} days\n", .{days}); } try client.sendPrune(api_key_hash, prune_type, value); @@ -95,13 +95,13 @@ pub fn run(allocator: std.mem.Allocator, args: []const []const u8) !void { if (flags.json) { std.debug.print("{\"ok\":true}\n", .{}); } else { - logging.success("Prune operation completed successfully\n", .{}); + io.success("Prune operation completed successfully\n", .{}); } } else { if (flags.json) { std.debug.print("{\"ok\":false,\"error_code\":{d}}\n", .{response[0]}); } else { - logging.err("[FAIL] Prune operation failed: error code {d}\n", .{response[0]}); + io.err("[FAIL] Prune operation failed: error code {d}\n", .{response[0]}); } return error.PruneFailed; } @@ -109,16 +109,16 @@ pub fn run(allocator: std.mem.Allocator, args: []const []const u8) !void { if (flags.json) { std.debug.print("{\"ok\":true,\"note\":\"no_response\"}\n", .{}); } else { - logging.success("Prune request sent (no response received)\n", .{}); + io.success("Prune request sent (no response received)\n", .{}); } } } fn printUsage() void { - logging.info("Usage: ml prune [options]\n\n", .{}); - logging.info("Options:\n", .{}); - logging.info("\t--keep \t\tKeep N most recent experiments\n", .{}); - logging.info("\t--older-than \tRemove experiments older than N days\n", .{}); - logging.info("\t--json\t\t\tOutput machine-readable JSON\n", .{}); - logging.info("\t--help, -h\t\tShow this help message\n", .{}); + io.info("Usage: ml prune [options]\n\n", .{}); + io.info("Options:\n", .{}); + io.info("\t--keep \t\tKeep N most recent experiments\n", .{}); + io.info("\t--older-than \tRemove experiments older than N days\n", .{}); + io.info("\t--json\t\t\tOutput machine-readable JSON\n", .{}); + io.info("\t--help, -h\t\tShow this help message\n", .{}); } diff --git a/cli/src/net/ws/deps.zig b/cli/src/net/ws/deps.zig index 3c78f77..db0ba81 100644 --- a/cli/src/net/ws/deps.zig +++ b/cli/src/net/ws/deps.zig @@ -3,6 +3,6 @@ pub const std = @import("std"); pub const colors = @import("../../utils/colors.zig"); pub const crypto = @import("../../utils/crypto.zig"); pub const io = @import("../../utils/io.zig"); -pub const log = @import("../../utils/logging.zig"); +pub const log = io; pub const protocol = @import("../protocol.zig");