Kinda made a dotenv parser on "accident"

Hey Ziggit folks!

While adding env var support to my CLI arg parser argh, I accidentally built a full dotenv parser! Extracted it into zdotenv

It’s both projects are fairly simple, but I’d appreciate any feedback.

Thank you

1 Like

Hey @dayvster, welcome!

Nice projects you have there!

I had a look at zdotenv and I think you’d up your game by making use of the Reader API. Take your time to get through it, no rush. The reason for that is that you’d avoid byte-per-byte manipulation with functions like takeDelimiterExclusive

Another tip is to avoid access and try opening the file directly. You’ll get the same errors for open as you get for access (FileNotFound, for example), with one “atomic” operation.

3 Likes

Thank you!

Glad to be a part of the community!

That is great feedback and exactly the kind I was hoping for.
I’ve bookmarked that and will check it out over the weekend as my day-to-day job schedule this week is just packed full.

Another tip is to avoid access and try opening the file directly. You’ll get the same errors for open as you get for access (FileNotFound, for example), with one “atomic” operation.

Oh so I would not have to manually define and return those errors then. That’s great I have to implement that.

1 Like