talira

urfave/cli

A declarative, simple, fast, and fun package for building command line tools in Go

open sourceMITfree

urfave/cli is a declarative package for building command-line tools in Go. It gives you commands and subcommands with alias and prefix matching, a flexible generated help system, dynamic shell completion for bash, zsh, fish and PowerShell, man page and Markdown documentation generation, flags for simple types, slices, times and durations, compound short flags (-abc), and flag values read from environment variables and files (structured config formats through urfave/cli-altsrc). v3, installed with the /v3 module suffix, is the recommended version for new work.

Problems it solves

  • build a command-line tool in Go with subcommands and flags
  • add shell completion to my Go CLI
  • read CLI flag values from environment variables in Go
  • generate help text and man pages for a Go command

Features

  • commands and subcommands with aliases
  • generated help
  • shell completion for bash, zsh, fish and PowerShell
  • man and Markdown docs generation
  • typed flags including slices and durations
  • flag values from env vars and files

Alternatives

The same job

These do what urfave/cli does.

  1. Cobra Go library for modern CLI apps with subcommands, POSIX flags and generated completions

Compare urfave/cli with the top 3