Shout out to my wife who makes these hilarious thumbnails, follow her on twitter and instagram for more art stuff.
CLI applications are extremely handy to use. Building out alot of the nice features that good CLI apps have can be a bit time consuming though.
At least, it was, until cobra was created and that changed everything.
Cobra is a go package that can be utilized to create very robust CLI applications with very little effort.
It provides an impressive list of features:
- Subcommand-based CLIs
- POSIX-compliant flags (short/long versions)
- Nested subcommands
- Global, local, and cascading flags (explained in video)
- Application and command generator
- Auto suggestions on command typos
- Automatic help generation
- Automatic help flag recognition
- Generates shell autocompletion for bash, zsh, fish, and powershell
- Generates documentation, such as man pages
- Command aliases
- Integrates very well with viper
Check out the video tutorial where I give some basic examples of the various features of cobra.
If you liked it and want to know when I post more, be sure to subscribe and thank ya'll again for your time!
Top comments (0)