提交 55948988 编写于 作者: L Lin Ma 提交者: Michal Privoznik

virsh: Conditionally Ignore the first entry in list of completions

The first entry in the returned array is the substitution for TEXT. It
causes unnecessary output if other commands or options share the same
prefix, e.g.

$ virsh des<TAB><TAB>
des      desc     destroy

or

$ virsh domblklist --d<TAB><TAB>
--d        --details  --domain

This patch fixes the above issue.
Signed-off-by: NLin Ma <lma@suse.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 f3097dc8
......@@ -3493,7 +3493,10 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
if (!(matches = vshReadlineCompletion(arg, 0, 0)))
goto cleanup;
for (iter = matches; *iter; iter++)
/* 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++)
printf("%s\n", *iter);
ret = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册