Browse Source

only allow one parser

Isaac 2 năm trước cách đây
mục cha
commit
2e658cfa56
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      borgmatic/commands/completion.py

+ 4 - 2
borgmatic/commands/completion.py

@@ -65,6 +65,8 @@ def fish_completion():
     '''
     top_level_parser, subparsers = arguments.make_parsers()
 
+    all_subparsers = ' '.join(action for action in subparsers.choices.keys())
+
     # Avert your eyes.
     return '\n'.join(
         (
@@ -78,8 +80,8 @@ def fish_completion():
             'end',
             '__borgmatic_check_version &',
         ) + tuple(
-            '''complete -c borgmatic -a '%s' -d %s -f'''
-            % (actionStr, shlex.quote(subparser.description))
+            '''complete -c borgmatic -a '%s' -d %s -f -n "not __fish_seen_subcommand_from %s"'''
+            % (actionStr, shlex.quote(subparser.description), all_subparsers)
             for actionStr, subparser in subparsers.choices.items()
         ) + tuple(
             '''complete -c borgmatic -a '%s' -d %s -f'''