Nice zpinner in the terminal made in zig.
Find a file
2024-07-11 11:24:35 +02:00
src fix: Update to zig 0.13.0 2024-06-07 23:14:19 +02:00
.gitignore fix: Update to zig 0.13.0 2024-06-07 23:14:19 +02:00
build.zig chore: Initial commit 2024-05-14 23:09:10 +02:00
build.zig.zon fix: Update to zig 0.13.0 2024-06-07 23:14:19 +02:00
LICENSE Initial commit 2024-05-14 23:07:44 +02:00
README.md docs: Update README 2024-07-11 11:24:35 +02:00

zpinner

Nice zpinner in the terminal for zig.

Usage

const std = @import("std");
const zpinner = @import("zpinner.zig");

pub fn main() !void {
    const stdout_file = std.io.getStdOut().writer();
    var zpin = zpinner.new(stdout_file.any(), .{});
    zpin.set_indicator(zpinner.Moon);
    zpin.set_suffix(" calculating route to the moon");
    try zpin.start();
    std.time.sleep(5 * std.time.ns_per_s);
    try zpin.stop();
    zpin.set_suffix(" counting snakes");
    zpin.set_indicator(zpinner.Snake);
    try zpin.start();
    std.time.sleep(5 * std.time.ns_per_s);
    zpin.set_indicator(zpinner.Earth);
    zpin.set_suffix(" calculating route back to earth");
    std.time.sleep(5 * std.time.ns_per_s);
    try zpin.stop();
    zpin.set_suffix(" calculating next week weather");
    zpin.set_indicator(zpinner.Weather);
    try zpin.start();
    std.time.sleep(5 * std.time.ns_per_s);
    try zpin.stop();
    zpin.set_suffix(" ZzZzz...");
    zpin.set_indicator(zpinner.Clock);
    try zpin.start();
    std.time.sleep(5 * std.time.ns_per_s);
    try zpin.stop();

    try stdout_file.print("work done\n", .{});
}