urfave/cli is a Go library for building command line applications. It targets Go developers who want a declarative way to define commands, subcommands, and flags without pulling in extra dependencies beyond the Go standard library. The project has been around long enough to have a stable API, active maintenance, and companion modules for docs generation and structured config sources.
The library handles the repetitive parts of CLI building: parsing flags, generating help text, matching command aliases, and wiring up shell completion. You define your command tree declaratively (commands, subcommands, flags, actions) and the library takes care of parsing and dispatch.
bash, zsh, fish, and powershell.-a -b -c into -abc.urfave/cli-docs module.urfave/cli-altsrc module.This library fits developers writing internal tools, DevOps utilities, or public CLI products in Go where they want structured command handling instead of hand-rolling flag package logic. It works well for tools with nested subcommands (think git-style command trees) or apps that need shell completion out of the box.
It's also a good fit if you want config values to come from multiple sources (env vars, files, flags) without writing that merging logic yourself, since the urfave/cli-altsrc module handles JSON, TOML, and YAML sources.
It is not the right choice if you need a CLI framework for a language other than Go, or if your tool is a single command with one or two flags where the standard library's flag package is already sufficient. If you want a framework with a large ecosystem of third-party plugins, this library keeps its core dependency-free by design, so extra functionality lives in separate companion modules you add as needed.
Add the library to your Go module:
go get github.com/urfave/cli/v3
Import it in your code:
import "github.com/urfave/cli/v3"
Define a command and run it from your main function, using the command/flag structures documented on the hosted docs site. For documentation generation, add the companion module:
go get github.com/urfave/cli-docs
For loading flag values from structured config files (JSON, TOML, YAML) or environment variables beyond the built-in support, add:
go get github.com/urfave/cli-altsrc
Full usage examples, flag definitions, and API details live in the hosted documentation at cli.urfave.org, built from the repo's ./docs directory.