#Line Ending Utility (crlf)

1 messages · Page 1 of 1 (latest)

outer solstice
#

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.

GitHub

CR LF utility. Contribute to hrgdavor/zig-crlf development by creating an account on GitHub.

old aspen
#

Link? Also, you might want to actually explain what it does?

outer solstice
#

one thing I did learn while troubleshooting git action is that at least in this case goto-bus-stop/setup-zig@v2 works better than mlugg/setup-zig@v1

#

the binary is so small, I love ZIG 🙂

fervent ice
#

If there's some outdated documentation somewhere indicating that you should use v1 please let me know

#

Please try switching to mlugg/setup-zig@v2, and if that doesn't work I'd appreciate if you could open an issue; the goto-bue-stop action is deprecated for various reasons, but one is that if too many people use that it can kinda hammer ziglang.org :P (its caching never really worked right) (which I don't blame goto-bus-stop for, because when writing my one I got to learn just how awful GitHub Actions' cache system is)

outer solstice
#

sure, thank you for he clarification.
As I said, it was all AI generated, I am now in phase of taking over the code and cleaning it up, that is why I asked for feedback.
I very early in learning stage for zig. Any other pointers are welcome.

outer solstice
#

@fervent ice silversquirl/vs3 on github is no more, I checked your website and clicked the link

fervent ice
#

oh yeah that repo was removed but my website's been untouched for years