]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Don't skip the first entry when the typed command share same prefix
authorLin Ma <lma@suse.com>
Fri, 11 May 2018 09:13:10 +0000 (17:13 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 11 May 2018 11:13:22 +0000 (13:13 +0200)
Signed-off-by: Lin Ma <lma@suse.com>
tools/vsh.c

index f76076b16493c5c9388974238a03820d2235d4b0..1516e578d987955010ec05afd471baa2f7cbff3a 100644 (file)
@@ -3495,11 +3495,11 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
     if (!(matches = vshReadlineCompletion(arg, 0, 0)))
         goto cleanup;
 
-    /* According to rl_completion_matches documentation, the
-     * first entry in @matches array is some dummy substitution
-     * string for @arg. Skip it. */
-    for (iter = &matches[1]; *iter; iter++)
+    for (iter = matches; *iter; iter++) {
+        if (iter == matches && matches[1])
+            continue;
         printf("%s\n", *iter);
+    }
 
     ret = true;
  cleanup: