What is the best language/framework to write CLIs in 2018?
Hello HN,
I have an idea for a CLI and want to start writing it soon. I want a robust language/framework that is meant for writing CLIs. I have used Golang/Cobra before and I have done minor things using C++.
I also want this to be a learning experience. So I will be starting with the language/framework from absolute scratch.
So the secondary question behind this Ask HN is, which CLI framework should you know in 2018?
(
14 comments
| 4 points
| on HN
)
If you're writing something that takes a bunch of flags, then parses text, I'd use perl. If you're using somethign that must be easily installed on 100+ hosts then perhaps a binary compiled from go - because that's easy to install.
For frameworks? That's probably secondary to the actual core of your application. If you're writing a complex UI with (n)curses then that's more interesting and complex than calling getopt a few times..
I find that I always need various random things to work together and have always found Python to be the most robust at this. Plus it has pretty much anything you'd need already implemented.
Otherwise python is the go-to because of the libs.
Isn't that what mypy is for?
Definitely Perl for UNIXy stuff.
After all the research, I am still highly inclined towards Golang. Since you said "Perl or Go", you seem to have used Golang. How does Perl compare with it?
UNIX commandline and Perl is a match made in heaven.
Using Golang will demand significantly more effort when doing more complex stuff but will give you concurrency, easier deploys/multi-platform support and better performance if doing CPU intensive stuff.
Thanks to the quick compile time and good tooling Go almost feels like a scripting language when developing but especially for UNIXy stuff it can't replace Perl for me.