Writing CLIs
2025-12-13 07:24:21 +01:00 by Mark Smith

I re-wrote all my blogging scripts a couple of months ago. That’s been a resounding success. I use them most days, and it’s made my blogging workflow much more streamlined. I have some more improvements I’d like to make, and some interesting future projects I want to be in a position to explore. The annoying thing with the scripts in their current form is that they are written in Bash. Things can get kind of gnarly in Bash.
To be clear, I have nothing against Bash. It’s really usef…
Writing CLIs
2025-12-13 07:24:21 +01:00 by Mark Smith

I re-wrote all my blogging scripts a couple of months ago. That’s been a resounding success. I use them most days, and it’s made my blogging workflow much more streamlined. I have some more improvements I’d like to make, and some interesting future projects I want to be in a position to explore. The annoying thing with the scripts in their current form is that they are written in Bash. Things can get kind of gnarly in Bash.
To be clear, I have nothing against Bash. It’s really useful for getting things up and running quickly. It’s very practical, and flexible and you have a million tools at your disposal that are tried and tested, and they tend to work quite well together. But when you want to do something a bit more elegant than just running a sequence of commands one after the other, with a few ifs and loops, then it can seem very archaic. So I’ve decided to re-write my blogging scripts in Node.js.
I’m pretty excited about this, because it will turn my very functional, but somewhat clunky blogging tools, into a streamlined, efficient and extensible command line interface (CLI). I have written a few CLIs over the years, but the past few years my energies have been mostly focussed on web development, so it’s been very interesting discovering all the new CLI focussed libraries that now exist. Things in CLI-land are orders of magnitude better than they were last time I was here.
The most useful libraries so far have been:
- tj/commander.js - For CLI argument parsing.
- privatenumber/tasuku - For running tasks with awesome UX.
- SBoudrias/Inquirer.js - For it‘s superb collection of command line user interfaces.
I also decided on using the more modern ES Modules rather than CommonJS, and so opted to use Vitest for my testing framework instead of Mocha or Jest. I was already running Vitest on all my React frontend projects, but it turns out it’s great out of the box with any ESM based projects. So far no major issues.
I already have a minimal Node.js project up and running, and I’m likely going to spend some time updating it to Typescript, given how successful Typescript has been in all my recent web development projects, especially those that I have been working on with AIs. Feeling pretty good about it :) #