This file provides a comprehensive overview of the zigcli project, its structure, and how to build, run, and contribute to it.
zigcli is a toolkit for building command-line programs in Zig. It can be used as a collection of Zig packages or as standalone command-line programs.
Key Technologies:
- Language: Zig
- Build System: Zig Build System
- Dependencies:
curl(for thezigfetchbinary)
Architecture:
The project is structured into two main parts:
src/mod: Contains reusable Zig modules (pretty-table,structargs).src/bin: Contains a collection of standalone command-line programs.
The primary way to build the project is using the Zig build system. The Makefile provides convenient targets for common tasks.
Key Commands:
- Build all binaries:
Or, for a release build:
zig build
make build
- Run a specific binary:
For example, to run the
zig build run-<binary_name>
treebinary:zig build run-tree
- Run all tests:
Or:
zig build testmake test - Format the code:
Or to check formatting:
zig fmt .make fmt
- Clean the build artifacts:
make clean
- Serve the documentation:
make serve
- Code Style: The project uses
zig fmtto enforce a consistent code style. Before committing, ensure your code is formatted by runningzig fmt .. - Testing: All modules and binaries have corresponding tests. All tests can be run with
zig build test. - Dependencies: Dependencies are managed by the Zig build system in
build.zig. - Continuous Integration: The project uses GitHub Actions for CI. The CI pipeline is defined in
.github/workflows/CI.ymland it runsmake ciwhich is an alias formake fmtandmake test. - Documentation: The project's documentation is built with Hugo and is located in the
docsdirectory.