We're in the process of unifying a bunch of small tools into a single binary and using a subcommand to launch the specific tool.
I have a potentially unknown number of scripts calling some of these tools, so it'd be handy if Swift Argument Parser would "auto-route" to a subcommand based on the contents of argv[0].
That is, if I had the subcommand "hello" and I had a symlink pointing to my executable ("tool") named "hello" (hello -> tool), the subcommand should trigger automatically when invoked from this symlink.
Bundle.main.executableURL works "correctly" with symlinks (returns the name of the link rather than the name of the link target), which is the behaviour OP is after in this case.
That’s an interesting question! This should be doable if you implement your own static func main() method on your root command. The default implementation drops the first argument from CommandLine.arguments before beginning parsing, so what you could do is check if the first argument is one of your recognized commands, and then send the full list to parseAsRoot(_:) instead.