Skip to content

jiacai2050/zigcli

Repository files navigation

Zigcli

https://img.shields.io/github/stars/jiacai2050/zigcli.svg https://img.shields.io/github/license/jiacai2050/zigcli.svg https://github.com/jiacai2050/loc/actions/workflows/CI.yml/badge.svg https://github.com/jiacai2050/loc/actions/workflows/binary.yml/badge.svg

Zigcli is a toolkit for building command lines programs in Zig.

This package provides:

Modules
Zig modules to help developers build their awesome cli programs. Currently there are:
  • simargs, which is used to parse arguments
  • pretty-table, which is used to print aligned and formatted tables
Programs
Practical command line programs which can be used directly. Currently there are:
  • loc, lines of code.
  • tree, list contents of directories in a tree-like format.
  • yes, output a string repeatedly until killed.
  • repeat, repeat a command until it succeeds.
  • pidof, like pidof, but for macOS.
  • night-shift, control Night Shift in macOS.
  • dark-mode, control dark mode in macOS.

Install

Programs

Prebuilt binaries can be found in CI’s artifacts, or you can build from source:

git clone https://github.com/jiacai2050/zigcli.git

Then build with

make build

To build zigcli locally, Zig master is required, which can be downloaded here.

Modules

zigcli support package manager introduced in Zig 0.11.

zig fetch --save=curl https://github.com/jiacai2050/zigcli/archive/${COMMIT}.tar.gz

Replace ${COMMIT} with a real one, then in your build.zig, import the module like this:

const zigcli = b.dependency("zigcli", .{});

// Currently zigcli provide two modules.
exe.root_module.addImport("simargs", zigcli.module("simargs"));
exe.root_module.addImport("pretty-table", zigcli.module("pretty-table"));

Who’s Using

If you’re using zigcli, and would like to be added here, welcome to open a PR.

Roadmap

Loc

  • Performance, at least comparable with cgag/loc #1
  • More options, such as --exclude <regex>
  • Support multiline comment

License

MIT, see LICENSE for details.

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages