https://github.com/kingrashy12/ziglet
A lightweight command-line interface (CLI) builder.
https://github.com/kingrashy12/ziglet
cli-builder zig-package
Last synced: 6 months ago
JSON representation
A lightweight command-line interface (CLI) builder.
- Host: GitHub
- URL: https://github.com/kingrashy12/ziglet
- Owner: Kingrashy12
- License: mit
- Created: 2025-07-12T18:52:29.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-08-02T14:32:25.000Z (6 months ago)
- Last Synced: 2025-08-02T16:30:22.769Z (6 months ago)
- Topics: cli-builder, zig-package
- Language: Zig
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🐣 Ziglet – Your Minimalist CLI Builder in Zig
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.
## ✨ Features
- Add and organize custom commands with ease
- Execute commands with `executeCommand` built into Ziglet
- Minimal dependencies, maximum speed
- Built in Zig for clarity, performance, and control
## 📚 How to Use
1. Fetch the package:
```bash
zig fetch --save git+https://github.com/Kingrashy12/ziglet
```
2. Add the module to your `build.zig`:
```zig
// Add the ziglet dependency
const ziglet_dep = b.dependency("ziglet", .{
.target = target,
.optimize = optimize,
});
// Add the ziglet module to the executable
exe.root_module.addImport("ziglet", ziglet_dep.module("ziglet"));
```
3. Import and use in your code:
```zig
const std = @import("std");
const ziglet = @import("ziglet");
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
var commander = try ziglet.Commander.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: *ziglet.Commander) !void {
std.debug.print("Hello from {s}!\n", .{self.name});
}
```
## 🤝 Contributing
Want to make Ziglet even snappier? Feel free to open issues, suggest features, or submit pull requests. Let’s build something sharp together.
## 📄 License
MIT – free to use, modify, and share.