2 ms·
How is Nim for cli scripting? I tend to use Bash for simple scripts, and Python once I need more than one command line argument. I've been looking for a compell
by cpburns2009 2y ago
How is Nim for cli scripting? I tend to use Bash for simple scripts, and Python once I need more than one command line argument. I've been looking for a compelling case to try out Nim.
- BiteCode_dev 2y agoIt's Python-like, but it compiles, so you get a stand alone exec like go, that you can copy on other machines without having to provide an interpretter. It's better than bash for anything longer than 5 lines, works on Windows and Unix and has a lean syntax. Now I would use Python for scripting, especially since uv and hatch have inline deps support now, so it's a blast. But OP is looking for something new, so I list things he may enjoy learning, in a context that would make it enjoyable to learn.
- cb321 2y agoWhen making small Nim programs for the CLI, https://github.com/c-blake/cligen https://github.com/c-blake/cligen makes for a pretty simple API (just 1 line of code) that gets you nice CLI syntax, color auto-generated help messages, etc.