Releases: xcaeser/zli
Releases · xcaeser/zli
v4.2.0
v4.1.1
v4.1.0
zli v4.1.0
Completely reworked the spinner, with a simplified api:
- spinner.start
- spinner.updateMessage
- spinner.succeed, fail, info
- recommendation to use spinner.print instead of your own writer.print to not have non-displayed messages as spinner works on its own thread.
full changelog: v4.0.3...v4.1.0
v4.0.3
zli v4.0.3
full changelog: v4.0.2...v4.0.3
v4.0.2
full changelog: v4.0.1...v4.0.2
v4.0.1
zli v4.0.1
- Improved error handling instead of process exit
- Internal improvements for Command with better code
full changelog: v4.0.0...v4.0.1
v4.0.0
zli v4.0.0
- Update the project to use Zig version 0.15.1 to use the new zig Io Writergate :)
- Documentation update
- Adjustments to spinner
- Internal improvements for Command with better code
full changelog: v3.7.1...v4.0.0
v3.7.1
zli v3.7.1
- Improve section sorting for commands,
- remove the preferred optimization mode from the build configuration,
- and clarify the spinner feature as experimental in the documentation.
- Update version references throughout the README and related files.
full changelog: v3.7.0...v3.7.1
v3.7.0
zli v3.7.0
Important
Introducing Spinners! by @xcaeser in #16
Spinners are a new feature in zli v3.7.0. Accessible through ctx.spinner, They are a powerful and customizable CLI spinner that can be used in any command's execFn.
Here's an example of how it works:
fn run(ctx: CLICommandContext) !void {
const writer = ctx.command.stdout; // Convenience
// --- Example 1: Basic single-line spinner ---
try writer.print("\n--- Example 1: Single-Line Spinner ---\n", .{});
try ctx.spinner.start(.{}, "Starting a simple, single-line task...", .{});
std.time.sleep(2 * std.time.ns_per_s);
try ctx.spinner.succeed("Single-line task complete!", .{});
std.time.sleep(1 * std.time.ns_per_s);
// --- Example 2: Multi-step process ---
try writer.print("\n--- Example 2: Multi-Step Process ---\n", .{});
try ctx.spinner.start(.{}, "Step 1: Initializing network...", .{});
std.time.sleep(1500 * std.time.ms_per_s);
try ctx.spinner.nextStep("Step 2: Authenticating user...", .{});
std.time.sleep(1500 * std.time.ms_per_s);
try ctx.spinner.updateText("Step 2: Authentication is taking a moment...", .{});
std.time.sleep(1500 * std.time.ms_per_s);
try ctx.spinner.nextStep("Step 3: Fetching data...", .{});
std.time.sleep(2 * std.time.ns_per_s);
try ctx.spinner.fail("Failed to fetch data from server.", .{});
std.time.sleep(1 * std.time.ns_per_s);
// --- Example 3: Adding log lines during a process ---
try writer.print("\n--- Example 3: Process with Log Lines ---\n", .{});
try ctx.spinner.start(.{}, "Downloading and unpacking files...", .{});
std.time.sleep(1 * std.time.ns_per_s);
try ctx.spinner.addLine("Downloaded archive.zip (2.5 MB)", .{});
std.time.sleep(1 * std.time.ns_per_s);
try ctx.spinner.addLine("Unpacking to /tmp/my-app...", .{});
std.time.sleep(1500 * std.time.ms_per_s);
try ctx.spinner.addLine("Verified file integrity.", .{});
std.time.sleep(1 * std.time.ns_per_s);
try ctx.spinner.succeed("All files ready.", .{});
std.time.sleep(1 * std.time.ns_per_s);
// --- Example 4: Customizing style at runtime ---
try writer.print("\n--- Example 4: Customizing Style at Start ---\n", .{});
try ctx.spinner.start(.{
.frames = zli.SpinnerStyles.bouncing_bar,
.interval_ms = 120,
}, "Running with a different style...", .{});
std.time.sleep(3 * std.time.ns_per_s);
try ctx.spinner.info("Custom run finished for your information.", .{});
try writer.print("\n", .{});
}full changelog: v3.6.3...v3.7.0