DEV Community

Discussion on: Meet zx: A Better Way to Write Scripts with Node.js

Collapse
 
vonheikemen profile image
Heiker

I saw that the other day, I must say I like a lot because it looks similar to a thing I did a while ago. But there is a "missed oportunity" in this tool. The implementation of $ is not really cross-platform, which is quite a shame. Also, it would be nice if they provide an argument parser like minimist or arg.

Collapse
 
lakatos88 profile image
Alex Lakatos 🥑

Yeah, I think it's still very new, and might mature in the future. I have high hopes for it.

I don't usually think about shell scripts as accepting arguments, I usually build CLIs for that use case, with things like oclif or js-fire. But when I was trying to use arguments in zx even if for the sake of my example, I did miss a better way to parse arguments than process.argv. Hopefully it's something they'll add in the near future.

Collapse
 
vonheikemen profile image
Heiker

Looking throught the issues it does appear like the maintainer wants to keep things as simple as possible. Doesn't look too eager to change things. Anyway, is still a good project.

You know I just remembered something: one can actually install this tool directly from github. So, people could fork this project, tweak a little bit and then install the fork like this.

npm install --global github:<some-user-name>/zx
Enter fullscreen mode Exit fullscreen mode

That would be an interesting use of this npm install feature.

Thread Thread
 
lakatos88 profile image
Alex Lakatos 🥑

Oh, that's a really good idea. Especially since the work required would be minimal, for example using minimist for arguments would imply adding a few lines for importing the package and exposing it within the scope of zx.