/zigcli

A toolkit for building command lines programs in Zig.

Primary LanguageZigMIT LicenseMIT

Zigcli

https://github.com/jiacai2050/loc/actions/workflows/CI.yml/badge.svg https://github.com/jiacai2050/loc/actions/workflows/binary.yml/badge.svg

Command line programs written in Zig. Currently there are:

  • loc, lines of code.
  • tree, list contents of directories in a tree-like format.
  • yes, output a string repeatedly until killed.
  • pidof, like pidof, but for macOS.
  • night-shift, control Night Shift in cli, build for macOS.
  • repeat, repeat a command until it succeeds.

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.

Tree

./zig-out/bin/tree zig-out
zig-out
└──bin
   ├──loc
   ├──pidof
   ├──tree
   └──yes

1 directories, 4 files

Loc

./zig-out/bin/loc
Language File Line Code Comment Blank Size
-------- ---- ---- ---- ------- ----- -------
Zig      8    1427 1210 45      172   41.19K
YAML     6    195  182  5       8     5.03K
Makefile 1    12   8    0       4     206.00B
Python   1    10   7    2       1     166.00B
C        1    9    2    4       3     34.00B
Ruby     1    8    5    2       1     201.00B
-------- ---- ---- ---- ------- ----- -------
Total    18   1661 1414 58      189   46.81K

Night shift

./zig-out/bin/night-shift -h
USAGE:
    ./zig-out/bin/night-shift [OPTIONS] [--] <command>

Available commands by category:
Manual on/off control:
  status                   View current Night Shift status
  on                       Turn Night Shift on
  off                      Turn Night Shift off
  toggle                   Toggle Night Shift

Color temperature:
  temp                     View temperature preference
  temp  <0-100>            Set temperature preference

Schedule:
  schedule                 View current schedule
  schedule sun             Start schedule from sunset to sunrise
  schedule off             Stop the current schedule
  schedule <from> <to>     Start a custom schedule(HH:mm, 24-hour format)

OPTIONS:
	-v, --version                     Print version
	-h, --help                        Print help information

Roadmap

Loc

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

License

Zigcli is licensed under the GPL 3.0 or later, see LICENSE for details.