Wow, what a treasure trove of nice ideas, thank you for sharing that document Brian! I didn’t realize that you had sketched something similar out. It looks like we arrived at a lot of the same conclusions. I’ll definitely be using this document for some more inspiration. And by the way, since you’ve already considered an API similar to this, I’d love to hear your thoughts on the API design if you have any first impressions!
The main group I had in mind for using this library are package authors as you say. I’ve built a lot of code generation packages (such as elm-typescript-interop and elm-electron in addition to graphqelm), so it’s actually a pretty common problem just for me alone
. I think that code generation libraries are ideally suited to an Elm-based CLI because all they do is process the CLI options (argv), generate code (a bunch of Strings), and spit it out into files. So most of the JS interop needed is just an init flag to get argv and a port to write to a file.
I see similar imperative options parsing code in the elm-test codebase which I imagine could be nicer to maintain using elm-cli-options-parser.
I also found that doing things like processing stdin was quite doable with a decent abstraction around the ports. I was pretty happy with my Stdin module in the grep example that I built.
I hope that helps answer your question, I’ve found that it was useful enough just for code generation libraries to merit building this library for me. But I hope that others might find it useful for building small, simple tools, perhaps ones that don’t involve lots of intricate Unix low-level functionality. But again, from the examples that I’ve built, I just needed a simple command-line interface to tell Elm to do some heavy lifting, and then it only called on minimal Unix tasks to finish the job.
Thanks for all your thoughts, Brian, I really appreciate it!