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

You Might Also Like
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
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