Swift Argument Parser is a type-safe, declarative library for building Swift command-line tools by annotating your command types with property wrappers like @Option, @Argument, and @Flag. It handles parsing, validation, automatic help generation, and dispatch to your run() or async entry point, letting you focus on command logic instead of boilerplate. The package supports subcommands, default values, custom parsing strategies, and rich error messages that match platform conventions. It integrates cleanly with Swift Package Manager, works well in CI, and provides incremental improvements such as Sendable conformances for wrappers to help in concurrent contexts. The issue tracker and releases show active maintenance, real-world usage patterns, and design notes for advanced scenarios like collecting unrecognized arguments or mixing parent options with subcommands. Overall, it standardizes CLI ergonomics across the Swift ecosystem with a small, testable surface.
Features
- Declarative, type-safe parsing with property wrappers
- Automatic help, usage, and error messaging
- First-class subcommands and custom parsing strategies
- Async command support with clean run() entry points
- SwiftPM integration and CI-friendly tooling
- Sendable-aware wrappers to play nicely with concurrency