Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: xcaeser/zli

v4.2.0

14 Oct 15:33
7c97a9c

Choose a tag to compare

zli v4.2.0

  • bump zig version to 0.15.2
  • breaking: addition of io reader in the command struct for ease of use. checkout the README.md for examples.

full changelog: v4.1.1...v4.2.0

v4.1.1

24 Aug 10:17
e7c1eab

Choose a tag to compare

zli v4.1.1

  • Fixed spinner index out of bounds.

full changelog: v4.1.0...v4.1.1

v4.1.0

23 Aug 23:29
7ca7a08

Choose a tag to compare

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

21 Aug 22:10
4e24bd9

Choose a tag to compare

zli v4.0.3

full changelog: v4.0.2...v4.0.3

v4.0.2

21 Aug 21:37

Choose a tag to compare

full changelog: v4.0.1...v4.0.2

v4.0.1

21 Aug 20:40

Choose a tag to compare

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

21 Aug 18:44
0d09821

Choose a tag to compare

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

19 Jun 17:25
53450f7

Choose a tag to compare

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

10 Jun 21:50

Choose a tag to compare

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

v3.6.3

01 Jun 18:21
4daf709

Choose a tag to compare

What's Changed

  • Clarify pointer types in CommandContext, Update version to 3.6.3 by @xcaeser in #15

Full Changelog: v3.6.2...v3.6.3