News Score: Score the News, Sort the News, Rewrite the Headlines

Stop writing CLI validation. Parse it right the first time.

I have this bad habit. When something annoys me enough times, I end up building a library for it. This time, it was CLI validation code. See, I spend a lot of time reading other people's code. Open source projects, work stuff, random GitHub repos I stumble upon at 2 AM. And I kept noticing this thing: every CLI tool has the same ugly validation code tucked away somewhere. You know the kind: if (!opts.server && opts.port) { throw new Error("--port requires --server flag"); } if (opts.server && !o...

Read more at hackers.pub

© News Score  score the news, sort the news, rewrite the headlines