8000 Releases Β· xcaeser/zli Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Releases: xcaeser/zli

v3.7.0

10 Jun 21:50
Compare
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
Compare
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

v3.6.2

28 May 14:19
Compare
Choose a tag to compare

What's Changed

  • Refactor flag printing for improved alignment and efficiency by @xcaeser in #13

Full Changelog: v3.6.1...v3.6.2

v3.6.1

27 May 19:07
f54b1b8
Compare
Choose a tag to compare

What's Changed

  • Enhance command functionality with flag and positional argument tests by @xcaeser in #8
  • Improve error handling and update version to 3.6.1 by @xcaeser in #9
  • ci: update build command to include summary output during tests by @xcaeser in #10

Full Changelog: v3.6.0...v3.6.1

v3.6.0

27 May 14:41
c6884dd
Compare
Choose a tag to compare

What's Changed

  • Add support for command aliases and update version to 3.6.0 by @xcaeser in #7

New Contributors

  • @xcaeser made their first contribution in #7 - lol what?

Full Changelog: v3.5.3...v3.6.0

v3.5.3

27 May 08:15
Compare
Choose a tag to compare

v3.5.3

  • added support for hidden flags
  • help is now a defined flag for every command

Full changelog: v3.5.2...v3.5.3

v3.5.2

25 May 22:00
Compare
Choose a tag to compare

v3.5.2

  • updated build.zig to remove unnecessary libc linking...

Full changelog: v3.5.1...v3.5.2

v3.5.1

25 May 17:12
Compare
Choose a tag to compare

Internal improvement

  • Improved parsing to reduce number of loops = faster cli.

Full Changelog: v3.5.0...v3.5.1

v3.5.0

24 May 16:29
Compare
Choose a tag to compare

Important

NEW: Parsing of flags and positional args is interchangeable

Full Changelog: v3.4.0...v3.5.0

v3.4.0

24 May 16:08
Compare
Choose a tag to compare

πŸ“¦ v3.4.0 – Enhanced Positional Argument Support & UX Improvements

Release date: 2025-05-24

✨ New Features

  • Positional Arguments:

    • Added full support for required and variadic positional arguments.
    • New API: ctx.getArg("name") for easy access to named positional inputs.
    • Enhanced help output now includes Arguments section with clear formatting.
    • Added automatic usage line generation with printUsageLine().
  • Improved Help Output:

    • printHelp() now includes:

      • Usage line with flags and args.
      • Positional arguments list with required/variadic indicators.
      • Improved call-to-action line (e.g., command --help).

πŸ” Behavioral Changes

  • findLeaf() now detects and handles unknown subcommands vs. expected positional args more gracefully.
  • parsePositionalArgs() enforces required arg count and variadic placement.

πŸ§ͺ Tests Added

  • Coverage for:

    • Positional argument enforcement.
    • getArg() access behavior.
    • CLI structure integrity with nested commands and flags.

🧹 Cleanups

  • Removed unused legacy help/print code.
  • Removed unused CommandContext.flag() fallback if no default exists (now unreachable by design).

[!IMPORTANT] This release includes breaking behavior for commands with positional arguments. If you use ctx.positional_args directly, consider migrating to ctx.getArg("name").

Full Changelog: v3.3.1...v3.4.0

0