apple / apple/swift-argument-parser

Ability to specify posix '-V', and modern 'version', 'help' for version and help

Open
#661 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

## --version, -V, version

The posix tradition has been to use `-V` as short for `--version` (but `-v` is reserved for `--verbose` or sometimes `--inverse`), so naturally one of the first things I tried when I realized it was missing was to specify that - but there's no `versionNames` to match `helpNames`.

Many modern commands also use `version`, as an argument, without the `--` flag prefix.

I'd like to be able to support all three.

## --help, help, (no arguments)

Also, help is traditionally `--help` (with `-h` reserved for `--human-readable`), but many modern programs use `help` (or no arguments).

I'd like to be able to support `--help`, `help`, and _no arguments_ simultaneously.

## Can't override the defaults

Since I can't add the options I want, I thought perhaps I could disable the built-in help flag and parse my own, but doesn't seem to be working as expected either.

I would love it if this would either support the conventional help and version flags / arguments by way of options, or at least allow me to disable the built-in so that I can provide it in the most common configurations in the "happy path" configuration.

## Sort-of Workaround

I think it's pretty reasonable to limit help to just `--help` and having `help` as a subcommand, and I could do the same with `--version` and `version`, but that doesn't give me `-V`.

I'm poking through the documentation to see if there's a way to just use the arguments parser and table generator with custom control-flow...

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the documentation and the arguments parser and table generator APIs mentioned in the issue, including how built-in help and version options are configured or disabled. Done means users can support --help, help, no arguments, --version, version, and -V together, or can reliably replace the built-ins with custom control flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.