Standard CLI

58 projects

This subcategory lists libraries for parsing command-line arguments and building command-based programs, plus shell completion, readline-style input and a few CLI applications. Go's standard flag package handles single-command tools with Go-style flags such as -name=value, but it has no subcommands, no GNU-style --long and -s short flag pairs, and no generated help for nested commands.

spf13/cobra is the most used framework for subcommand CLIs and powers kubectl, Hugo and the GitHub CLI; it uses spf13/pflag for POSIX-style flags and can generate shell completions and documentation. urfave/cli is a long-standing alternative with a declarative command structure. alecthomas/kong builds the command tree from struct tags and supersedes kingpin from the same author. alexflint/go-arg and jessevdk/go-flags are also struct-based and suit tools with many options and few commands. carapace generates completions for cobra commands, and peterh/liner offers line editing with history.

For a small tool, flag or pflag keeps dependencies at zero or one. For a CLI with nested commands, help text and completions, cobra is the common choice, and its cobra-cli generator scaffolds a project. If you prefer declaring options as struct fields over registering flags in code, kong or go-arg produce less boilerplate. Read configuration from the environment as well as flags for anything that runs in containers.

cobraby spf13

Commander for modern Go CLI interactions.

github.com/spf13/cobraGo 1.15+ 4 dependenciesv1.10.2updated 3mo ago

44.7k

urfave/cliby urfave

Simple, fast, and fun package for building command line apps in Go (formerly codegangsta/cli).

github.com/urfave/cli/v3Go 1.26+ 1 dependencyv3.14.0updated today

24.3k

elvishby elves

An expressive programming language and a versatile interactive shell.

src.elv.shGo 1.22+ 8 dependenciesv0.21.0updated 7mo ago

6.4k

kingpinby alecthomas

Command line and flag parser supporting sub commands (superseded by kong; see below).

github.com/alecthomas/kingpin/v2Go 1.17+ 3 dependenciesv2.4.0updated 13d ago

3.6k

Dnote

A simple command line notebook with multi-device sync.

github.com/dnote/dnoteGo 1.25+ 19 dependenciescli-v0.17.0updated 16d ago

3.1k

pflagby spf13

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

github.com/spf13/pflagGo 1.12+ No dependencies v1.0.10updated 4d ago

2.8k

go-flagsby jessevdk

Go command line option parser.

github.com/jessevdk/go-flagsGo 1.24+ 2 dependenciesv1.6.1updated 23d ago

2.7k

go-argby alexflint

Struct-based argument parsing in Go.

github.com/alexflint/go-argGo 1.18+ 2 dependenciesv1.6.1updated 15d ago

2.3k

carapace-binby rsteube

Multi-shell multi-command argument completer.

github.com/carapace-sh/carapace-binGo 1.26+ 17 dependenciesv1.8.2updated today

2k

opsby nanovms

Unikernel Builder/Orchestrator.

github.com/nanovms/opsGo 1.26+ 62 dependencies0.1.47updated 1mo ago

1.5k

carapaceby rsteube

Command argument completion generator for spf13/cobra.

github.com/carapace-sh/carapaceGo 1.24+ 4 dependenciesv1.18.0updated 1d ago

1.5k

linerby peterh

Go readline-like library for command-line interfaces.

github.com/peterh/linerGo 1.26+ 2 dependenciesupdated 26d ago

1.1k

completeby posener

Write bash completions in Go + Go command bash completion.

github.com/posener/completeGo 1.13+ 2 dependenciesv2.1.0updated 1y ago

958

flaggyby integrii

A robust and idiomatic flags package with excellent subcommand support.

github.com/integrii/flaggyGo 1.25+ No dependencies v1.8.0updated 3mo ago

955

mow.cliby jawher

Go library for building CLI applications with sophisticated flag and argument parsing and validation.

github.com/jawher/mow.cliGo 1.13+ 1 dependencyv1.2.0updated 2y ago

883

mkideal/cliby mkideal

Feature-rich and easy to use command-line package based on golang struct tags.

github.com/mkideal/cliGo 1.13+ 7 dependenciesv0.2.5updated 1mo ago

723

argparseby akamensky

Command line argument parser inspired by Python's argparse module.

github.com/akamensky/argparseGo 1.13+ No dependencies v1.4.0updated 4y ago

639

wmenuby dixonwille

Easy to use menu structure for cli applications that prompt users to make choices.

github.com/dixonwille/wmenu/v5Go 1.11+ 3 dependenciesv4.0.2updated 1y ago

229

climaxby tucnak

Alternative CLI with "human face", in spirit of Go command.

github.com/tucnak/climaxGo 1.15+ No dependencies updated 6y ago

215

vibecheckby rshdhere

Cross-platform CLI that generates Git commit messages automatically from code changes.

github.com/rshdhere/vibecheckGo 1.25+ 11 dependenciesv1.7.7updated 5d ago

213

clîrby leaanthony

A Simple and Clear CLI library. Dependency free.

github.com/leaanthony/clirGo 1.12+ No dependencies v1.7.0updated 2y ago

202

hiboot cliby hidevopsio

Cli application framework with auto configuration and dependency injection.

github.com/hidevopsio/hiboot/pkg/app/cliGo 1.24+ v1.8.4updated 4mo ago

180

commandeerby jaffee

Dev-friendly CLI apps: sets up flags, defaults, and usage based on struct fields and tags.

github.com/jaffee/commandeerGo 1.12+ 2 dependenciesv0.6.0updated 4y ago

175

sflagsby octago

Struct based flags generator for flag, urfave/cli, pflag, cobra, kingpin, and other libraries.

github.com/urfave/sflagsGo 1.21+ 9 dependenciesv0.4.1updated 10mo ago

168

acmdby cristalhq

Simple, useful, and opinionated CLI package in Go.

github.com/cristalhq/acmdGo 1.17+ No dependencies v0.12.0updated 2y ago

155

readlineby reeflective

Shell library with modern and easy to use UI features.

github.com/reeflective/readlineGo 1.25+ 4 dependenciesv1.3.0updated 1mo ago

152

jobby liujianping

JOB, make your short-term command as a long-term job.

github.com/liujianping/jobGo 1.14+ 4 dependenciesv0.2.0updated 6y ago

151

cmdrby hedzr

A POSIX/GNU style, getopt-like command-line UI Go library.

github.com/hedzr/cmdr/v2Go 1.26+ 8 dependenciesv2.2.9updated 2d ago

143

teris-io/cliby teris-io

Simple and complete API for building command line interfaces in Go.

v1.0.1updated 5y ago

132

envby codingconcepts

Tag-based environment configuration for structs.

github.com/codingconcepts/envGo 1.22+ No dependencies updated 2y ago

125

consoleby reeflective

Closed-loop application library for Cobra commands, with oh-my-posh prompts, and more.

github.com/reeflective/consoleGo 1.25+ 7 dependenciesv0.5.0updated 3mo ago

117

versionby mszostok

Collects and displays CLI version information in multiple formats along with upgrade notice.

go.szostok.io/versionGo 1.19+ 13 dependenciesv1.2.0updated 3y ago

114

command-chainby rainu

A go library for configure and run command chains - such as pipelining in unix shells.

github.com/rainu/go-command-chainGo 1.23+ 3 dependenciesupdated 1y ago

71

gocmdby devfacet

Go library for building command line applications.

github.com/devfacet/gocmd/v3Go 1.17+ 1 dependencyv3.1.3updated 3y ago

67

wlogby dixonwille

Simple logging interface that supports cross-platform color and concurrency.

github.com/dixonwille/wlog/v3Go 1.11+ 2 dependenciesupdated 1y ago

67

strumtby antham

Library to create prompt chain.

github.com/antham/strumt/v2Go 1.24+ 1 dependencyv2.4.0updated 2mo ago

63

go-getoptionsby DavidGamba

Go option parser inspired by the flexibility of Perl’s GetOpt::Long.

github.com/DavidGamba/go-getoptionsGo 1.16+ No dependencies v0.33.0updated 1y ago

59

boaby GiGurra

Declarative flags, env vars, validation, and config files from struct tags. Built on cobra.

github.com/GiGurra/boaGo 1.25+ 2 dependenciesv1.0.31updated 13d ago

48

flagvarby sgreben

A collection of flag argument types for Go's standard flag package.

github.com/sgreben/flagvarGo 1.23+ 1 dependencyv1.10.2updated 2y ago

48

cmdby posener

Extends the standard flag package to support sub commands and more in idiomatic way.

github.com/posener/cmdGo 1.13+ 3 dependenciesv1.3.4updated 6y ago

47

mcliby jxskiss

A minimal but very powerful cli library for Go.

github.com/jxskiss/mcliGo 1.18+ 2 dependenciesv0.10.1updated 1mo ago

47

OpenCLIby bcdxn

OpenAPI-style specification for CLIs; define your interface in a language-agnostic document to generate documentation and framework boilerplate code.

github.com/bcdxn/opencliGo 1.26+ 12 dependenciesv1.3.0updated 1mo ago

45

argvby cosiner

Go library to split command line string as arguments array using the bash syntax.

github.com/cosiner/argvGo 1.13+ No dependencies updated 6y ago

43

hashicorp/cliby hashicorp

Go library for implementing command-line interfaces.

github.com/hashicorp/cliGo 1.23+ 6 dependenciesupdated 1mo ago

43

go-readline-nyby nyaosorg

A customizable line-editing library with Emacs keybindings, Unicode support, completion, and syntax highlighting. Used in NYAGOS shell.

github.com/nyaosorg/go-readline-nyGo 1.18+ 5 dependenciesv1.16.2updated 19d ago

37

carapace-specby rsteube

Define simple completions using a spec file.

github.com/carapace-sh/carapace-specGo 1.24+ 5 dependenciesv1.10.2updated 1d ago

36

orpheusby agilira

CLI framework with security hardening, plugin storage system, and production observability features.

github.com/agilira/orpheusGo 1.25+ 3 dependenciesv1.6.0updated 26d ago

34

structcliby leodido

Eliminate Cobra boilerplate: build powerful, feature-rich CLIs declaratively from Go structs.

github.com/leodido/structcliGo 1.24+ 11 dependenciesv0.19.0updated 3mo ago

18

memshby amjadjibon

Virtual bash shell in Go: executes shell commands against an in-memory filesystem (afero), with WASM plugin support and an embeddable HTTP server.

github.com/amjadjibon/memshGo 1.26+ 23 dependenciesv0.0.15updated 2mo ago

15

subcmdby bobg

Another approach to parsing and running subcommands. Works alongside the standard flag package.

github.com/bobg/subcmd/v2Go 1.21+ 2 dependenciesv2.4.0updated 9mo ago

15

flash-flagsby agilira

Ultra-fast, zero-dependency, POSIX-compliant flag parsing library that can be used as drop-in stdlib replacement with security hardening.

github.com/agilira/flash-flagsGo 1.25+ No dependencies v1.3.0updated 1mo ago

12

getoptby jon-codes

An accurate Go getopt, validated against the GNU libc implementation.

github.com/jonathonwebb/getoptGo 1.23+ 1 dependencyupdated 8mo ago

9

GoPOSIXby ramayac

A Go-native, single-binary multicall with 77 POSIX tools and >97% BusyBox test compatibility.

github.com/ramayac/goposixGo 1.26+ 10 dependenciesv1.3.1updated 22d ago

9

neuron-cliby steevin

A local-first, Obsidian-compatible terminal knowledge manager.

github.com/steevin/neuron-cliGo 1.26+ 16 dependenciesv1.4.0updated 1mo ago

8

gooptby napalu

A declarative, struct-tag based CLI framework for Go, with a broad feature set such as hierarchical commands/flags, i18n, shell completion, and validation.

github.com/napalu/gooptGo 1.18+ 7 dependenciesv2.4.11updated 4mo ago

5

go-archby SalvucciFacundo

CLI tool for scaffolding Go applications with Minimalist, Standard, and Hexagonal architecture patterns.

github.com/SalvucciFacundo/go-arch/v2Go 1.24+ 8 dependenciesv2.0.3updated 1mo ago

4

gozenby tech-thinker

Gozen is a simplified golang MVC framework to generate projects and components with Support of REST, gRPC etc. Higly customizable and easy to add any api layer or worker.

github.com/tech-thinker/gozenGo 1.22+ 2 dependenciesv1.0.1updated 22d ago

4

Fling-CLIby SatyamKumarCS

Terminal-based peer-to-peer file and message transfer tool over custom reliable UDP.

github.com/SatyamKumarCS/Fling-CLIGo 1.25+ 3 dependenciesv1.0.0updated 1mo ago

0
Esc

Type to search every entry. ↑↓ to move, Enter to open.