Here is a small utility I needed from time to time, and zig fits perfectly as it can create small lean binaries for multiple platforms.
https://github.com/hrgdavor/zig-crlf
A lightweight Zig utility to check and convert line endings across multiple files using glob patterns.
- Multi-variant Detection: Identifies LF (Unix), CRLF (Windows), CR (Classic Mac), and Mixed line endings.
- Batch Conversion: Convert files to your preferred line ending variant.
- Multiple Glob Support: Target specific files or directories using multiple wildcard patterns (e.g., src/**/*.zig README.md).
- Recursive Globbing: Support for standard ** recursive matching across directories.
- Detailed Reporting: Shows counts for each line ending type found in a file.
Sadly, I am too new to zig to manually code even a small thing like this, so I used Antigravity to generate it.
I am using it to learn zig, and at this stage, I just chose something small enough I can easily grasp,
so I can focus on how zig code works.
It works well because it does only few simple things that are easy to test, still if anyone is willing to take a look
at the code to point if things should be done differently and better please tell.
CR LF utility. Contribute to hrgdavor/zig-crlf development by creating an account on GitHub.