swift-argument-parser icon indicating copy to clipboard operation
swift-argument-parser copied to clipboard

USAGE command name should always reflect the actual binary name

Open eaigner opened this issue 3 years ago • 1 comments

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.

eaigner avatar Apr 03 '21 13:04 eaigner

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]?

frou avatar Apr 12 '21 19:04 frou