Kingrashy12/ziglet
A lightweight command-line interface (CLI) builder.
Ziglet is a lightweight command-line interface (CLI) builder. It lets you effortlessly define custom commands and execute them using Ziglet's core executeCommand
functionality—giving you a flexible and blazing-fast CLI tool tailored to your needs.
executeCommand
built into Zigletconst std = @import("std");
const cmd = @import("ziglet").Commander;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
var commander = try cmd.init(allocator, "my-cli", "0.1.0", null);
defer commander.deinit();
// Define a simple command
try commander.addCommand("greet", "Say Hello", greetFn, null);
try commander.checkArgs();
try commander.executeCommand();
}
// The function to execute
fn greetFn(self: *cmd) void {
std.debug.print("Hello from {s}!\n", .{self.name});
}
Want to make Ziglet even snappier? Feel free to open issues, suggest features, or submit pull requests. Let’s build something sharp together.
MIT – free to use, modify, and share.