On Thu, Aug 13, 2026 at 16:58:37 +0200, Peter Krempa via Devel wrote:
> On Mon, Jul 13, 2026 at 12:14:48 +0200, Radosław Śmigielski via Devel wrote:
> > From: Radoslaw Smigielski <[email protected]>
> > 
> > The '--type' option of 'domdisplay' command selects a particular
> > graphical display type.
> > 
> > Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9
> > Signed-off-by: Radoslaw Smigielski <[email protected]>
> > ---
> >  tools/virsh-completer-domain.c | 12 ++++++++++++
> >  tools/virsh-completer-domain.h |  5 +++++
> >  tools/virsh-domain.c           |  1 +
> >  3 files changed, 18 insertions(+)
> > 
> > diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
> > index 8bdf68ac091d..afb080b868d7 100644
> > --- a/tools/virsh-completer-domain.c
> > +++ b/tools/virsh-completer-domain.c
> > @@ -1132,3 +1132,15 @@ virshDomainNetTypeCompleter(vshControl *ctl 
> > G_GNUC_UNUSED,
> >      return vshEnumComplete(VIR_DOMAIN_NET_TYPE_LAST,
> >                             virDomainNetTypeToString);
> >  }
> > +
> > +
> > +char **
> > +virshDomainDisplayTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
> > +                                const vshCmd *cmd G_GNUC_UNUSED,
> > +                                unsigned int flags)
> > +{
> > +    virCheckFlags(0, NULL);
> > +
> > +    return vshEnumComplete(VIR_DOMAIN_GRAPHICS_TYPE_LAST,
> > +                           virDomainGraphicsTypeToString);
> > +}
> > diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
> > index dfbc10acaaa8..3aab7bedae20 100644
> > --- a/tools/virsh-completer-domain.h
> > +++ b/tools/virsh-completer-domain.h
> > @@ -204,3 +204,8 @@ char **
> >  virshDomainNetTypeCompleter(vshControl *ctl,
> >                              const vshCmd *cmd,
> >                              unsigned int flags);
> > +
> > +char **
> > +virshDomainDisplayTypeCompleter(vshControl *ctl,
> > +                                const vshCmd *cmd,
> > +                                unsigned int flags);
> > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> > index 0a383ea40013..f15f686c7908 100644
> > --- a/tools/virsh-domain.c
> > +++ b/tools/virsh-domain.c
> > @@ -12182,6 +12182,7 @@ static const vshCmdOptDef opts_domdisplay[] = {
> >      {.name = "type",
> >       .type = VSH_OT_STRING,
> >       .positional = true,
> > +     .completer = virshDomainDisplayTypeCompleter,
> >       .help = N_("select particular graphical display "
> >                  "(e.g. \"vnc\", \"spice\", \"rdp\", \"dbus\")")
> >      },
> 
> Within 'cmdDomDisplay' there's a list of supported display types
> ('scheme' array) that command works with, but this completes a
> different list.
> 
> The completer should complete entries from the same list (and there must
> be just one instance of that list).
> 
> I'll drop this patch before pushing so you can address that
> individually.

Actually, since the supported list is a subset, I think the completer
can complete these.

Reviewed-by: Peter Krempa <[email protected]>

Reply via email to