apple / apple/swift-argument-parser
Add ability to infer root command name from CLI args
- Dominant language
- Swift
- Stars
- 3.8k
- Forks
- 411
- Avg merge
- 7d 14h
- Merged PRs (30d)
- 15
Description
The command name of a (`Async`)`ParsableCommand` is [inferred from the name of the struct](https://apple.github.io/swift-argument-parser/documentation/argumentparser/commandconfiguration/commandname) by default.
For the root command, this name is never actually part of a command; it's only used in the usage string.
You can of course override it manually, but you never know if the executable gets renamed.
In my understanding, it's common for the usage string to use the actual name the command was invoked with (i.e. `argv[0]` in C terms). And I also think that's the only appropriate default behavior.
Contributor guide
Research direction
Start at ParsableCommand and CommandConfiguration, tracing how the root command name is inferred and how the invoked executable name is available from CLI arguments. The usage string should use the actual invoked name by default, including when the executable is renamed; add coverage for that behavior if the existing test entry point is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100