A type-safe Swift library for declaring and parsing command-line arguments, options, and flags with auto-generated help.
urfave/cli
A declarative Go package for building command line tools, with subcommands, flags, shell completion and help generation.
- Stars
- 24,291
- Forks
- 1,923
- Open issues
- 30
- Last commit
- 3 hours ago
What is it?
urfave/cli is a Go package for building command line applications. You define commands, subcommands and flags declaratively, and the package handles parsing, routing and help output.
It supports aliases and prefix matching for commands, compound short flags such as -abc, and flag types including simple values, slices, time and duration. Dynamic shell completion is available for bash, zsh, fish and PowerShell. The package has no dependencies beyond the Go standard library.
Input can be read from command-line flags, environment variables, plain text files, and structured formats such as JSON, TOML and YAML through the companion urfave/cli-altsrc module. Man page and Markdown documentation generation is provided by the urfave/cli-docs module.
Key features
- 01Commands and subcommands with alias and prefix matching
- 02Dynamic shell completion for bash, zsh, fish and PowerShell
- 03Compound short flags such as -abc
- 04Flags for simple types, slices, time and duration
- 05Input from environment variables, text files and JSON, TOML or YAML
- 06No dependencies beyond the Go standard library
Use cases
- Building a Go command line tool with subcommands and typed flags
- Adding shell tab completion to an existing CLI
- Loading CLI options from environment variables or config files in YAML or TOML
Topics
FAQ
- What is cli?
- A declarative Go package for building command line tools, with subcommands, flags, shell completion and help generation. urfave/cli is a Go package for building command line applications. You define commands, subcommands and flags declaratively, and the package handles parsing, routing and help output.
- Is cli free to use? What license does it have?
- cli is open source under the MIT license. Check the license terms before using it in commercial products.
- Is cli still maintained?
- Actively maintained. The last commit to cli was on Oct 19, 2026.
- What can I use cli for?
- Building a Go command line tool with subcommands and typed flags Adding shell tab completion to an existing CLI Loading CLI options from environment variables or config files in YAML or TOML
- Where can I get cli?
- The source code and installation instructions are on GitHub: https://github.com/urfave/cli
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A fast Python serialization and validation library that encodes and decodes JSON, MessagePack, YAML, and TOML using standard type annotations.
A feature-rich command-line tool for downloading audio and video from thousands of websites, forked from youtube-dl.
Command-line tool to sync, copy and mount files across more than 70 cloud storage providers and local storage, described as rsync for the cloud.
A smarter cd command that learns your most-used directories and lets you jump to them with a few keystrokes, across all major shells.
A Rust command-line tool that fetches data from 55+ websites such as Twitter/X, Reddit, YouTube and Hacker News with a single command.