swift-argument-parser
swift-argument-parser copied to clipboard
USAGE command name should always reflect the actual binary name
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.
Another common occurrence of this is running the executable via a symlink, where the symlink has a different basename to the executable it's pointing to.
I guess ProcessInfo.processInfo.processName
from Foundation already has the logic for slicing up argv[0]
?