apple / apple/swift-argument-parser

USAGE command name should always reflect the actual binary name

Open
#295 2 comments 10 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 13h
Merged PRs (30d)
17

Description

The default `USAGE` output derives the usage command name from the `ParsableCommand` type name. Now this might be correct or not. The "correct" way would be to always use the last path component of `argv[0]`, as it would also show the correct string in case the build product name is different from the class name or the user renames the tool.

While there is `_commandName` I can use to override this, it is marked as for internal use only.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the default USAGE generation from ParsableCommand and identify where the command name is derived. Compare that value with the last path component of argv[0], and review how the internal _commandName override currently affects it. Done means USAGE shows the actual executable name, including when the binary is renamed or differs from the type name.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.