Skip to content

Releases: Kingrashy12/ziglet

v0.9.0

20 Apr 16:06

Choose a tag to compare

Release v0.9.0 - Color System Refactor & API Improvements

🎨 Major Changes

Modular Color System

  • Extracted color handling into dedicated src/utils/color.zig module for better maintainability
  • New Color API with method chaining support for composing styles
  • Added comprehensive style support: bold, dim, italic, underline, blink, reverse, hidden, strikethrough
  • Full 16-color palette: Standard and bright variants for both foreground and background

🔧 API Updates

printColored Function

// Old API - single style only
printColored(.cyan, "text", .{});

// New API - multiple styles via slice
printColored(&[_]Color.Style{.cyan, .bold}, "text", .{});

New Color API Usage

// Method chaining
var color = Color.init(allocator);
defer color.deinit();
const styled = try color.bold().cyan().underline().paint("Hello World");

// One-shot helper
var colored = try Color.colored(allocator, "Error!", &[_]Style{.red, .bold});
defer colored.deinit();
print("{s}\n", .{colored.result});

📝 Improvements

  • Reduced code duplication in cli_builder.zig with new printOption function
  • Centralized color logic across cli_builder.zig and parser.zig
  • Better error logging cleanup in terminal utilities

📦 Version

  • Project version bumped to 0.9.0 in build.zig.zon

🔄 Migration Guide

Update any calls to printColored from:

printColored(.color_name, "text", .{});

to:

printColored(&[_]Color.Style{.color_name}, "text", .{});

For multiple styles:

printColored(&[_]Color.Style{.red, .bold, .underline}, "Important!", .{});

Full Changelog: compare v0.8.0...v0.9.0

v0.8.0

26 Jan 14:51

Choose a tag to compare

Main Feature

Added name and version fields to CommandContext

  • The CommandContext struct now includes CLI application metadata that can be accessed during command execution

Key Changes

  1. Enhanced Context Information

    • Commands can now access the CLI application's name and version at runtime
    • Useful for help messages, logging, or version-specific behavior
  2. Bug Fix: Memory Leak Resolution

    • Fixed memory leaks in the validateOptions function
    • Added proper error handling and memory deallocation to prevent resource leaks
  3. Documentation Updates

    • Examples updated to reflect new parameter naming conventions
    • Examples now demonstrate how to access the name field from context

v0.6.1

20 Dec 01:09
v0.6.1
c5ca342

Choose a tag to compare

v0.6.1

✨ New Features

  • Exported stripAnsi utility function as part of public utils API
  • Removes ANSI escape codes from strings for clean terminal output parsing

v0.6.0

06 Dec 01:40
34d9000

Choose a tag to compare

📢 Release Notes: Version 0.6.0

⚠️ BREAKING CHANGES

  • Memory Management: The signature of the formatBytes function has changed.
    • It now requires a std.mem.Allocator parameter for dynamic memory allocation.
    • The type of the bytes parameter has been changed from u64 to usize.
    • Action Required: Callers of formatBytes must now manually free the returned string slice using the provided allocator to prevent memory leaks.

🛠️ Fixed

  • Critical Memory Safety Fix: The formatBytes utility function has been corrected to properly allocate the formatted string in memory provided by the caller's allocator. This resolves a serious bug where the function was previously returning a dangling pointer (a reference to a local, temporary stack buffer) which would lead to unpredictable behavior, corruption, or crashes.

This change ensures the utility is robust and adheres to best practices for memory management in Zig.

v0.5.0

05 Dec 10:23
v0.5.0
c1af646

Choose a tag to compare

✨ New Feature

  • Added a new formatting utility function to utils/format.zig to provide enhanced text rendering options.

🛠️ Improvements & Bug Fixes

  • Linux Stability Fix: Resolved a critical bug where the CLI builder could crash on certain Linux environments due to improper initialization of the types.Value variable. The value is now correctly initialized to .undefined.
  • Cleaner Help Output: The Options: section in the generated help message is now only displayed if the command actually defines options, resulting in cleaner and more relevant output for simple commands.

v0.4.0

01 Dec 04:40
v0.4.0
fa717ba

Choose a tag to compare

Release Notes

Breaking Changes
  • CLI Builder API: Renamed the ActionArg struct to CommandContext for improved clarity and consistency. This update impacts all action function signatures, type exports, and related example code.
    Migration: Replace all instances of ActionArg with CommandContext in your codebase to ensure compatibility.

v0.3.1

01 Dec 03:57
v0.3.1
62d35fd

Choose a tag to compare

Release Notes — v0.3.1

This patch release focuses on stabilizing the CLI’s parsing logic and ensuring safer memory handling across core components.

Changes

✅ Improved resource cleanup in cli_builder.zig

  • Reorganized defer statements to guarantee consistent deallocation.
  • Ensures all allocated buffers and option structures are safely released, even on early returns or parsing failures.

✅ Added robust errdefer logic in parser.zig

  • Implemented errdefer blocks to clean up temporary containers and option maps when errors occur.
  • Reduces risk of memory leaks during option parsing, argument slicing, and command handling.

v0.2.0

25 Oct 11:14
v0.2.0
139188f

Choose a tag to compare

v0.2.0 - 2025-10-25

This release introduces several improvements and refactors to enhance Ziglet's functionality and maintainability.

Changes:

  • Refactor: The stdout module has been renamed to terminal for clarity.
  • Memory Management: Added an allocator field to the ActionArg struct to improve memory management.
  • Utility Functions: Introduced the cli_utils.zig module with utility functions (takeBool, takeString, takeNumber) for safer and more convenient value extraction in CLI action functions.
  • Deprecation Removal: Removed the deprecated install.zig file and its related features.
  • Parser Improvements: Enhanced the parser with improved boolean option handling.

v0.1.4

25 Sep 22:45
v0.1.4
b7d91df

Choose a tag to compare

Release Notes - Ziglet v0.1.4

🚀 What's New in Ziglet v0.1.4

Ziglet v0.1.4, packed with powerful new features that make building CLI applications in Zig even more delightful!

✨ New Features

🌍 Global Options Support

  • Automatically add --help and --version flags to all your commands
  • Define global options that work across your entire CLI application
  • No more repetitive option definitions!

🏭 Fluent Factory Pattern

  • Build commands with an elegant, chainable API: command().option().action().finalize()
  • More readable and maintainable command definitions
  • Perfect for complex CLI applications

🎯 Enhanced Option Types

  • Support for bool, string, and number option types
  • Type-safe option parsing and validation
  • Better error handling and user experience

📚 Improved Help System

  • Command-specific help with command --help
  • Beautiful, formatted help output
  • Clear usage instructions for each command

🔧 Developer Experience Improvements

  • Option Validation: Automatic validation of required options
  • Global Option Merging: Seamlessly combine global and command-specific options
  • Better Error Messages: More helpful feedback when things go wrong

📖 Examples & Documentation

Comprehensive examples have been added showing:

  • Basic CLI setup with commands and options
  • Global options configuration
  • Factory pattern for advanced use cases

Check out the examples/ directory for runnable code samples!

⚠️ Breaking Changes

This release includes some breaking changes to improve the API:

  • Action handlers now use ActionArg struct instead of separate parameters
  • parse() method signature updated for factory pattern support
  • Option definitions use the more structured CLIOption format

Migration Guide: Update your action functions to accept ActionArg and use the new option access pattern. See the updated README.md for examples.

🎉 Get Started

zig fetch --save git+https://github.com/Kingrashy12/ziglet

Then check out the new examples in the examples/ directory!


Full changelog: See CHANGELOG.md for complete technical details.

Thank you for using Ziglet! Your feedback would help build better tools 🐣

v0.1.3

13 Aug 02:48
v0.1.3
d89782d

Choose a tag to compare

v0.1.3 - CLI Flags & Compatibility

New Features & Improvements

  • Added short/long flag support: CLI options now accept both -o (short) and --output (long) forms. (#1) [@ciathefed]
  • Refactored install.zig: Fixed deprecated functions and integrated the new flag system. (#1) [@ciathefed]

Breaking Changes

  • Option.flagOption.long: The Option.flag field is now renamed to Option.long, with an optional Option.short field.
    • Migration: Update any code referencing Option.flag.

Other