simple.zig (458B)
1 const std = @import("std"); 2 const ProgressBar = @import("progress").Bar; 3 4 pub fn main(init: std.process.Init) !void { 5 var stdout_buf: [4096]u8 = undefined; 6 var stdout_writer = std.Io.File.stdout().writer(init.io, &stdout_buf); 7 var pb = ProgressBar.init(10, &stdout_writer, .{}); 8 9 while (!pb.isFinished()) { 10 pb.add(1); 11 try pb.render(); 12 13 try std.Io.sleep(init.io, std.Io.Duration.fromMilliseconds(150), .awake); 14 } 15 }