# apple/swift-argument-parser

Straightforward, type-safe argument parsing for Swift

Repository: https://github.com/apple/swift-argument-parser
Canonical: https://ross.abutalabs.com/products/swift-argument-parser
Homepage: https://swiftpackageindex.com/apple/swift-argument-parser/documentation
Language: Swift
License: Apache-2.0
License Family: permissive
Topics: cli, command-line, flag, option
Last push: 2026-08-26T19:55:19+00:00

## Health v2 (maintenance only)
Score: 93/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 80, longevity 100
- inputs: {"age_days": 2386, "days_push": 7, "days_rel": 56, "gap_med": 34, "n_releases_24m": 10}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3757, forks 406 (observed 2026-08-28T04:08:17.818850+00:00)

## What it is
A Swift library from Apple for type-safe command-line argument parsing using property wrappers and the ParsableCommand protocol. It automatically generates usage help, error messages, and flag/option handling from declarative type definitions.

## Use cases
- parse command-line arguments in a Swift CLI tool
- generate --help output automatically for a command-line utility
- define CLI flags and options with type safety
- build subcommand-based command-line tools in Swift
- handle CLI input validation with useful error messages

## When to choose
- you are writing a command-line tool in Swift and want declarative, type-safe argument parsing
- you want automatic help text, usage strings, and error messages generated from your types
- you need subcommands and async command support in a Swift CLI

## When to avoid
- you are building a GUI or web application, not a CLI
- your project is not in Swift
- you need extremely lightweight parsing and prefer hand-rolled argv handling

## Facets
- artifact type: library
- maturity: stable
- function: cli, parser, developer-tools
- domain: developer-tools, programming-languages
- platform: cross-platform
- tags: argument-parsing, property-wrappers, type-safe, swift-package, command-line, swift, macos, linux

## Member repositories
- apple/swift-argument-parser (main) score 93

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:17.818850+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-29T18:28:55.729689+00:00, confidence not recorded.
  - readme: https://github.com/apple/swift-argument-parser (fetched 2026-08-28T04:08:17.818850+00:00, sha 6d22aab2fe42)
- Data as of 2026-08-30T08:39:29.467469+00:00.
