external-dns
external-dns copied to clipboard
Replace Flags library alecthomas/kingpin with spf13/pflag
trafficstars
What would you like to be added:
✅ TL;DR
Use cobra for building modern, extensible CLI applications — especially if you want long-term support, Kubernetes-style UX, and active community backing.
Library spf13/cobra is in pretty much every kubernetes project https://github.com/search?q=org%3Akubernetes-sigs%20github.com%2Fspf13%2Fcobra&type=code
Avoid kingpin for projects. Although it offers a great developer experience, it is archived and no longer maintained.
Library kingpin only used in external-dns
Why is this needed:
⚔️ Comparing cobra vs kingpin for Go CLI Applications
📦 Feature Comparison
| Feature | cobra |
kingpin |
|---|---|---|
| Project Status | ✅ Actively maintained and widely used | ⚠️ Archived (read-only) |
| Subcommand support | ✅ First-class support with nested commands | ✅ Strong, elegant support |
| Help / Usage formatting | ✅ Customizable help output | ✅ Very clean help output |
| Flag parsing | ✅ Uses pflag for compatibility |
✅ Built-in (custom parsing) |
| Standard flag support | ✅ Compatible via pflag |
❌ Not compatible |
| Kubernetes adoption | ✅ Used by kubectl, controller-runtime, etc. |
❌ Not used |
| Command structure | ✅ Explicit tree structure | ✅ Declarative-style chain calls |
| Validation | ✅ Built-in validation | 🚫 Not supported out of the box (but possible) |
| Learning curve | 🟡 Slightly verbose at first | 🟢 Easy & readable |
| Last Update | ✅ 2+ month ago | ❌ 2+ years ago |
| Github Stars | ✅ 40k+ | 🟡 ~4k |