Our great sponsors
-
eclipse
Discontinued python-fire inspired library to simplify creating CLIs in Go, built on top of Cobra [Moved to: https://github.com/avamsi/clifr]
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
koanf
Simple, extremely lightweight, extensible, configuration management library for Go. Support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
(Shameless plug) Also check out https://github.com/avamsi/eclipse!
go-flags
kong
I’m a fan of both cobra and urfave/cli
I don't think it's what you're after and I haven't used it myself, but thought I'd share this so you're aware of just what all is out there: https://github.com/charmbracelet/bubbletea
I’ll be honest, I prefer urfave/cli over cobra generally speaking. Not for any reason outside of personal preference due to development experience. urfave/cli just feels more intuitive to me. However, if I’m building a CLI tool with really complex configuration, I’ll typically choose cobra and pair it with viper to make sure handling config loading is done properly. Both cobra and viper were written by the same person (and both widely used in production in conjunction with each other), so I trust they’ll play nicely.
You can also use Viper with urfave/cli, or you can replace Viper with knadh/koanf, which I personally prefer.
Related posts
- Coral, a friendly Cobra fork with nearly all its features, but only 4 dependencies
- What 3rd-party libraries do you use often/all the time?
- climate "CLI Mate": a CLI library that autogenerates CLIs from structs / functions with support for nested subcommands, global / local flags, help generation from godocs, typo suggestions, shell completion and more
- Which packages do you recommend for building cli tools?
- K3S Binary, How does that work?