Zli - A friendly fork of TigerBeetle's flag module

Hey everyone!

Over the last couple of weeks I have been learning Zig and loving the experience so far!

In one of my side / learning projects I had the need for a CLI arg parser. At the time, I was browsing through TigerBeetle’s codebase to get a feel for how comptime is being used when I stumbled upon their flags.zig module.

The interface the authors created for that library was a design I really liked, and the general guidelines for CLI parsing were very similar to my own preferences and, except for a few features, suited my use case well for this side project.

I forked much of that code, refactored a little and added in support for subcommand specific help and short options.

I thought, on the off chance that others like the original interface but were missing those features, that I would share the repo here:


Heads up, parsing of (multiple) positional arguments was broken completely as of yesterday, be sure to incude this change as well:

Another curious thing about original flags is testing. I giggle every time I see


Thanks for taking care of publishing it as a separate library! This is exactly our goal at TigerBeetle: while we want to stay focused on our specific requirements and don’t want to get distracted building reusable libraries (which is a hard job), our code is there to get copied, re-used and remixed!


Thank you for taking the time to reply and for the kind alert regarding the positional fields.

During testing I did come across that issue - I implemented a fix for it here and had actually planned on opening a PR against the original source today! I was too late, it seems, haha.

I really do appreciate just how awesome the Zig community is and am very impressed with all the work that is going on at TigerBeetle! Reading through just a small amount of the source and the guidelines in Tiger Style has been an immensely helpful :pray: