Cobra is a library for creating powerful modern CLI applications, and at the same time a program to generate applications and command files. It provides a simple interface for creating powerful CLI interfaces, and will also generate application scaffolding so you can quickly develop your Cobra-based application. This scaffolding includes easy subcommand-based CLIs, fully POSIX-compliant flags, global, local and cascading flags, among many others.

The structure of Cobra is based on commands, flags and arguments. The commands represent actions, the central point of the application; flags modify the behavior of commands; while arguments are things. With these easy-to-use concepts, users will natively understand how to use the application.

Features

  • Easy subcommand-based CLIs
  • Flags that are fully POSIX-compliant (both long and short versions)
  • Nested subcommands
  • Global, local and cascading flags
  • Generates applications & commands easily with cobra init appname & cobra add cmdname
  • Intelligent suggestions
  • Automatic help generation for commands and flags
  • Automatic help flag recognition of -h, --help, etc.
  • Automatic generation of bash autocomplete
  • Automatic generation of man pages
  • Command aliases, for changing things without breaking them
  • Define your own help, usage and more
  • Optional tight integration with viper for 12-factor apps

Project Samples

Project Activity

See All Activity >

License

Apache License V2.0

Follow Cobra

Cobra Web Site

Other Useful Business Software
Build on Google Cloud with $300 in Free Credit Icon
Build on Google Cloud with $300 in Free Credit

New to Google Cloud? Get $300 in free credit to explore Compute Engine, BigQuery, Cloud Run, Vertex AI, and 150+ other products.

Start your next project with $300 in free Google Cloud credit. Spin up VMs, run containers, query exabytes in BigQuery, or build AI apps with Vertex AI and Gemini. Once your credits are used, keep building with 20+ products with free monthly usage, including Compute Engine, Cloud Storage, GKE, and Cloud Run functions. Sign up to start building right away.
Start Free Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Cobra!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Go

Related Categories

Go Software Development Software, Go Libraries

Registered

2020-06-15