Fix application name when printing subcommand help.

I introduced this bug in PR #5754. It's fixed against master in #5796,
but that won't be backported to 2.x.
Merge pull request #5812 from takluyver/backport-fix-app-name

Fix application name when printing subcommand help.