Version subcommand support?

As follow up to, does it make sense to have standard support for a version subcommand for tools that use the subcommand model instead? (i.e. git version, hg version, etc.)

We can look at that, but I'm not sure there's as much need for a subcommand to be handled by the library as it is for the --version flag. The built-in flags have a lower precedence than those declared explicitly, so a tool can support the --version flag in most cases while also defining a --version option on a subcommand. This might not be the best interface pattern, but it's one we're supporting in SwiftPM:

% swift package --version
Swift Package Manager - Swift 5.1
% swift package resolve swift-argument-parser --version 0.0.1
Everything is already up-to-date

For a version subcommand, there's no special parser machinery required.

Terms of Service

Privacy Policy

Cookie Policy