# Cobra

> Go library for modern CLI apps with subcommands, POSIX flags and generated completions

Source: https://talira.ai/catalog/cobra-f5ka9qes
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Framework
- Categories: [libraries / cli frameworks](https://talira.ai/categories/libraries/cli-frameworks), [languages / go](https://talira.ai/categories/languages/go)
- Licence: Apache-2.0[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Self-hostable: yes[^2]
- Backed by: [Steve Francia](https://talira.ai/orgs/spf13.md)

Cobra is a Go library for building command-line applications with subcommands, like git and the go tool. It gives you nested subcommands, POSIX-compliant short and long flags (global, local and cascading), suggestions for mistyped commands, generated help, shell completions for bash, zsh, fish and PowerShell, man pages, command aliases and pre- and post-run hooks, and it pairs with Viper for configuration from files and environment variables. The cobra-cli generator scaffolds a new app. [Kubernetes](https://talira.ai/catalog/kubernetes-ftsegx3m.md), [Hugo](https://talira.ai/catalog/hugo-5t27gqmf.md) and [GitHub CLI](https://talira.ai/catalog/github-cli-gh-07he52ta.md) are built with it. Steve Francia created it.

## Links

- Website: https://cobra.dev/
- GitHub: https://github.com/spf13/cobra
- Docs: https://cobra.dev/docs/

## Problems it solves

- build a Go CLI with subcommands like git
- parse flags and subcommands in a Go command-line tool
- generate shell completions and man pages for my Go CLI
- scaffold a new Go command-line application

## Features

- nested subcommands
- POSIX-compliant global, local and cascading flags
- suggestions for mistyped commands
- generated help, man pages and shell completions (bash, zsh, fish, PowerShell)
- command aliases and pre/post-run hooks
- Viper integration for 12-factor configuration
- cobra-cli generator

## Trust

Overall: 0.50 out of 1.
Signals: maintenance 0.27, adoption 0.93, momentum 0.74, community 1.00, backing 0.30, extensibility 0.00.

- latest release v1.10.2 11 months ago
- 44.8k GitHub stars
- 330 contributors
- backed by Steve Francia

Warnings:

- last commit 4 months ago

## Alternatives

- [urfave/cli](https://talira.ai/catalog/urfave-cli-k7s1sg10.md): A declarative, simple, fast, and fun package for building command line tools in Go

## Sources

[^1]: https://github.com/spf13/cobra/blob/main/LICENSE.txt (checked 24 Nov 2026)
[^2]: https://github.com/spf13/cobra (checked 24 Nov 2026)
