# alexflint/go-arg

Struct-based argument parsing in Go

Repository: https://github.com/alexflint/go-arg
Canonical: https://ross.abutalabs.com/products/go-arg
Homepage: https://pkg.go.dev/github.com/alexflint/go-arg
Language: Go
License: BSD-2-Clause
License Family: permissive
Topics: argument-parsing, golang
Last push: 2025-12-27T22:04:21+00:00

## Health v2 (maintenance only)
Score: 60/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 59, release rhythm 38, longevity 100
- inputs: {"age_days": 3959, "days_push": 249, "days_rel": 253, "gap_med": 164, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2275, forks 114 (observed 2026-08-28T04:06:33.420321+00:00)

## What it is
go-arg is a Go library for parsing command line arguments by declaring them as struct fields with tags. It supports required and positional arguments, environment variables, subcommands, and automatic usage/help generation.

## Use cases
- parse command line flags into a Go struct
- define CLI arguments with struct tags
- read configuration from environment variables and flags
- generate usage and help text automatically
- handle positional arguments in a Go CLI
- build subcommands for a Go command-line tool

## When to choose
- you want declarative, struct-based flag parsing in Go with minimal boilerplate
- you need automatic help/usage generation and validation of required args
- you want flags backed by environment variables

## When to avoid
- you need advanced features like shell completion or complex grammar offered by cobra/urfave-cli
- you are not writing Go
- you need runtime-defined dynamic arguments rather than compile-time structs

## Facets
- artifact type: library
- maturity: stable
- function: cli, developer-tools
- domain: developer-tools
- platform: go, cross-platform
- tags: argument-parsing, struct-based, cli-flags, environment-variables, command-line

## Member repositories
- alexflint/go-arg (main) score 60

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:33.420321+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:41:28.850061+00:00, confidence not recorded.
  - readme: https://github.com/alexflint/go-arg (fetched 2026-08-28T04:06:33.420321+00:00, sha 4f61bfd16295)
  - homepage: https://pkg.go.dev/github.com/alexflint/go-arg (fetched 2026-08-29T10:21:55.911628+00:00, sha 3f96815bd4eb)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T10:21:55.915098+00:00, sha 757852027879)
  - site_page: https://go.dev/project (fetched 2026-08-29T10:21:55.917195+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
