Merge pull request #3088 from n-st/list-help-topics

List help topics when invalid topic is requested
This commit is contained in:
TW 2017-12-13 02:54:45 +01:00 committed by GitHub
commit f99785a00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -2013,7 +2013,12 @@ class Archiver:
else: else:
commands[args.topic].print_help() commands[args.topic].print_help()
else: else:
parser.error('No help available on %s' % (args.topic,)) msg_lines = []
msg_lines += ['No help available on %s.' % args.topic]
msg_lines += ['Try one of the following:']
msg_lines += [' Commands: %s' % ', '.join(sorted(commands.keys()))]
msg_lines += [' Topics: %s' % ', '.join(sorted(self.helptext.keys()))]
parser.error('\n'.join(msg_lines))
return self.exit_code return self.exit_code
def do_subcommand_help(self, parser, args): def do_subcommand_help(self, parser, args):