浏览代码

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

List help topics when invalid topic is requested
TW 7 年之前
父节点
当前提交
f99785a00d
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/borg/archiver.py

+ 6 - 1
src/borg/archiver.py

@@ -2013,7 +2013,12 @@ class Archiver:
             else:
                 commands[args.topic].print_help()
         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
 
     def do_subcommand_help(self, parser, args):