Explorar o código

List help topics when invalid topic is requested

(cherry picked from commit 9e81a7617216e16adaefad83fb58e22af9ddc9f8)
Nils Steinger %!s(int64=7) %!d(string=hai) anos
pai
achega
00865ae89e
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      src/borg/archiver.py

+ 6 - 1
src/borg/archiver.py

@@ -2205,7 +2205,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):