]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: Apply empty/local completers to global commands
authorPeter Krempa <pkrempa@redhat.com>
Tue, 20 May 2025 12:56:03 +0000 (14:56 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 21 May 2025 13:49:36 +0000 (15:49 +0200)
Few outstanding arguments were not marked with completers
completer despite the fact that we can't provide any reasonable
suggestion (e.g 'echo' or 'complete' commands) or where we want to
complete local path ( 'cd' ).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/vsh.c

index d1e699505b9118ec16dd48a9b6d3abd9e7fc1aa8..05845e2c1ed3f5013c7ae971a61b1e672810a8fa 100644 (file)
@@ -46,6 +46,8 @@
 #include "virstring.h"
 #include "virutil.h"
 
+#include "vsh-completer.h"
+
 #ifdef WITH_READLINE
 /* For autocompletion */
 vshControl *autoCompleteOpaque;
@@ -3283,6 +3285,7 @@ const vshCmdOptDef opts_cd[] = {
     {.name = "dir",
      .type = VSH_OT_STRING,
      .positional = true,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("directory to switch to (default: home or else root)")
     },
     {.name = NULL}
@@ -3340,11 +3343,13 @@ const vshCmdOptDef opts_echo[] = {
     },
     {.name = "prefix",
      .type = VSH_OT_STRING,
+     .completer = vshCompleteEmpty,
      .help = N_("prefix the message")
     },
     {.name = "string",
      .type = VSH_OT_ARGV,
      .positional = true,
+     .completer = vshCompleteEmpty,
      .help = N_("arguments to echo")
     },
     {.name = NULL}
@@ -3491,6 +3496,7 @@ const vshCmdOptDef opts_complete[] = {
      .type = VSH_OT_ARGV,
      .positional = true,
      .allowEmpty = true,
+     .completer = vshCompleteEmpty,
      .help = N_("partial string to autocomplete")
     },
     {.name = NULL}