Introduction
Zigcli is a toolkit for building command line programs in Zig.
zigcli has two faces:
- a set of reusable Zig packages for building terminal applications
- a collection of standalone CLI programs that can be installed and used directly
This repository keeps both sides together. If you are writing your own Zig tool, add zigcli as
a dependency and import the packages you need. If you only want ready-made binaries such as tree,
loc, pretty-csv, or cowsay, install the release package and run them directly.
Packages
The reusable packages are documented under Packages.
structargsturns a Zig struct into a command-line interface, including flags, defaults, enums, subcommands, and help text.csvparses delimited text into rows and fields for CSV- and TSV-style CLI workflows.pretty-tableprints aligned and formatted tables for terminal output.gitignoreparses and applies.gitignorerules in pure Zig.termprovides terminal styling and capability helpers such as ANSI colors and terminal width detection.
The root import is zigcli:
| |
Generated API documentation for the exported packages is available at apidocs.
Programs
The standalone tools are documented under Programs.
Some highlights:
loccounts lines of code across languagestreeprints directory trees with optional filteringpretty-csvrenders CSV and TSV files as aligned tableszfetchprints system informationcowsay,repeat, and other small terminal utilities round out the collection
The programs and packages are developed in the same repository, so the binaries can also serve as examples of how the reusable modules fit together.
Install
See INSTALL page.
Two common paths are:
- install prebuilt binaries with the shell installer
- add
zigclias a Zig dependency and use the packages directly
For binaries:
| |
For package use, see the install page and the package docs for the current build.zig
integration pattern.
Repository layout
src/contains the Zig source codesrc/bin/standalone CLI programssrc/reusable packages exported through thezigcliroot module
examples/contains small demo programsdocs/contains this website and the package/program documentation
Who's Using
If you're using zigcli, and would like to be added here, welcome to open a PR.
License
MIT, see LICENSE for details.