This is what is gross about Cobra
Probably as much as 90% of a command line interface (argument and flag) definitions can be declarative. Why are so many of the libraries (and toolboxes) so determined to be so verbose even for the simplest of interfaces?!
I shouldn’t pick on Cobra. Most (all?) of these libraries have serious problems.
But all are better than the standard library’s ridiculous opinion that they should stray from the standard that everyone has been using for decades.
There are times when you should try to make things better, simpler. And sometimes you shouldn’t.
Go’s flag
package sucks. The prevelance of packages that try to solve the problem
proves this to be true. I believe they fell victim to their own attempt to simplify
resulting them ignoring a good-enough, already relatively simple standard
that the entire world is reasonably comfortable with: --xyz
is one flag and -xyz
is three.
BTW, urfave/cli is the least sucky.