6 ms·
I always use go-flags [1] in my Go programs. It has support for GNU-style options, pretty help output, subcommands, automatic parsing of more complex arguments
by martinp 12y ago
I always use go-flags [1] in my Go programs. It has support for GNU-style options, pretty help output, subcommands, automatic parsing of more complex arguments (e.g. time.Duration) among other things.
I do wish they would improve the included flags package though. There are lots of nice third party packages, but having a proper one in the standard library would've been better.
[1] https://github.com/jessevdk/go-flags https://github.com/jessevdk/go-flags
- dvirsky 12y agoCame here to say this. go-flags is an excellent package, and makes great use of struct-tags. An extra bonus is that it can parse .ini files and command-line flags into the same underlying config struct, allowing one to override the other.