feat(cli): add ProgressBar to queue command for batch job processing

Integrate ProgressBar into queue.zig for multi-job queuing:
- Show progress bar when queuing 2+ jobs (not in JSON mode)
- Update progress after each successful job queue
- Maintain simple output for single job queuing
- Clean up output for batch operations

Benefits:
- Better UX for batch job queuing
- Visual progress indication for long operations
- Consistent with sync command ProgressBar pattern

All tests pass.
This commit is contained in:
Jeremie Fraeys 2026-03-04 21:26:58 -05:00
parent ef7d19db9b
commit 704099a13b
No known key found for this signature in database

View file

@ -8,6 +8,7 @@ const stdcrypto = std.crypto;
const mode = @import("../mode.zig");
const db = @import("../db.zig");
const manifest_lib = @import("../manifest.zig");
const progress = @import("../utils/progress.zig");
// Use modular queue structure
const queue_mod = @import("queue/mod.zig");
@ -352,8 +353,17 @@ fn executeQueue(allocator: std.mem.Allocator, args: []const []const u8, config:
const args_str: []const u8 = if (args_override) |a| a else args_joined;
const note_str: []const u8 = if (note_override) |n| n else "";
// Show progress bar for multiple jobs (not in JSON mode)
var pb: ?progress.ProgressBar = null;
if (!options.json and job_names.items.len > 1) {
pb = progress.ProgressBar.init(allocator, job_names.items.len, "Queuing jobs...");
}
defer if (pb) |*p| p.finish();
for (job_names.items, 0..) |job_name, index| {
std.debug.print("Processing job {d}/{d}: {s}\n", .{ index + 1, job_names.items.len, job_name });
if (!options.json and job_names.items.len == 1) {
std.debug.print("Processing job: {s}\n", .{job_name});
}
queueSingleJob(
allocator,
@ -375,8 +385,13 @@ fn executeQueue(allocator: std.mem.Allocator, args: []const []const u8, config:
continue;
};
std.debug.print("Successfully queued job '{s}'\n", .{job_name});
if (!options.json and job_names.items.len == 1) {
std.debug.print("Successfully queued job '{s}'\n", .{job_name});
}
success_count += 1;
// Update progress bar
if (pb) |*p| p.update(index + 1);
}
// Show summary