Command line programs written in Zig.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Jiacai Liu c333c6f1ff
chore: bump deps
1 week ago
.github feat(loc): support windows (#7) 2 months ago
src fix latest 2 months ago
tests feat(loc): multi line comments support (#5) 2 months ago
.gitattributes add binary CI 8 months ago
.gitignore first init 9 months ago
.woodpecker.yml add mirror 6 months ago
LICENSE add LICENSE 9 months ago
Makefile feat(loc): support windows (#7) 2 months ago
README.org feat(loc): multi line comments support (#5) 2 months ago
build.zig fix latest 2 months ago
build.zig.zon chore: bump deps 1 week ago

README.org

Zigcli

<img src=" title="https://github.com/jiacai2050/loc/actions/workflows/CI.yml/badge.svg" /> <img src=" title="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.

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

zig build -Doptimize=ReleaseFast

Zigcli currently supports Zig master, which can be downloaded here.

Tree

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

1 directories, 2 files
./zig-out/bin/tree -h
 USAGE:
     ./zig-out/bin/tree [OPTIONS] [--] [directory]

 OPTIONS:
	-m, --mode STRING                 Line drawing characters. (valid: ascii|box|dos)(default: box)
	-a, --all                         All files are printed.
	-s, --size                        Print the size of each file in bytes along with the name.
	-d, --directory                   List directories only.
	-L, --level INTEGER               Max display depth of the directory tree.
	-h, --help                        Prints help information.

Yes

Here pv is used to monitor io rate.

./zig-out/bin/yes | pv -r >/dev/null

[6.71GiB/s]

Loc

./zig-out/bin/loc
Language File Line Code Comment Blank Size
-------- ---- ---- ---- ------- ----- -------
Zig      7    896  756  22      118   24.72K
YAML     6    145  134  3       8     3.19K
Makefile 1    15   8    3       4     262.00B
Python   1    10   7    2       1     166.00B
C        1    9    2    6       1     34.00B
Ruby     1    8    5    2       1     201.00B
-------- ---- ---- ---- ------- ----- -------
Total    17   1083 912  38      133   28.56K
./zig-out/bin/loc -h
 USAGE:
     ./zig-out/bin/loc [OPTIONS] [file or directory]

 OPTIONS:
	-s, --sort STRING                 Column to sort by (valid: language|file|line|code|comment|blank|size)(default: line)
	-h, --help                        Prints help information

Roadmap

Loc

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

Tree

  • Add file size

License

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