"--" means no option at the following arguments. Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> --- diff --git a/tools/virsh.c b/tools/virsh.c index a5b438b..d01091f 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -10305,6 +10305,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser) vshCmdOpt *last = NULL; const vshCmdDef *cmd = NULL; int tk; + bool data_only = false; int data_ct = 0; first = NULL; @@ -10327,6 +10328,8 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser) goto syntaxError; /* ... or ignore this command only? */ } VIR_FREE(tkdata); + } else if (data_only) { + goto get_data; } else if (*tkdata == '-' && *(tkdata + 1) == '-' && *(tkdata + 2) && c_isalnum(*(tkdata + 2))) { char *optstr = strchr(tkdata + 2, '='); @@ -10368,7 +10371,12 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser) goto syntaxError; } } + } else if (*tkdata == '-' && *(tkdata + 1) == '-' + && *(tkdata + 2) == '\0') { + data_only = true; + continue; } else { +get_data: if (!(opt = vshCmddefGetData(cmd, data_ct++))) { vshError(ctl, _("unexpected data '%s'"), tkdata); goto syntaxError; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list