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
Gemini 3 and 200+ AI Models on One Platform Icon
Gemini 3 and 200+ AI Models on One Platform

Access Google's best plus Claude, Llama, and Gemma. Fine-tune and deploy from one console.

Build generative AI apps with Vertex AI. Switch between models without switching platforms.
Start Free
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