[libvirt] [PATCH 5/5]virsh: mark '--shareable' as VSH_OFLAG_IGNORE
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Tue Oct 22 06:48:33 UTC 2013
> -----Original Message-----
> From: Eric Blake [mailto:eblake at redhat.com]
> Sent: Tuesday, October 22, 2013 2:23 PM
> To: Chen Hanxiao; 'Michal Privoznik'
> Cc: libvir-list at redhat.com
> Subject: Re: [libvirt] [PATCH 5/5]virsh: mark '--shareable' as
> VSH_OFLAG_IGNORE
>
> On 10/22/2013 07:13 AM, Chen Hanxiao wrote:
>
> >>>
> >>
> >> Wow, we've never wanted to hide any option before? I've recall
> >> introducing VSH_OT_ALIAS, but there hasn't been anything else?
>
> We've always hidden one spelling that duplicates another, but this is a
> case where a boolean option is a duplicate of a non-boolean option, so
> I'm not sure if VSH_OT_ALIAS alone does what we want (or maybe it just
> means we enhance VSH_OT_ALIAS to be able to express a boolean alias for
> a non-boolean default).
>
> >
> > Do you mean we just treat --shareable as an alias for --mode like this:
> >
> > {.name = "shareable",
> > - .type = VSH_OT_BOOL,
> > + .type = VSH_OT_ALIAS,
> > - .help = N_("shareable between domains")
> > + .help = "mode"
>
> If it works. Maybe even by having it be an alias for .help =
> "mode=shareable" rather than just "mode", and teach VSH_OT_ALIAS to
> handle '=' within the .help text.
>
Better choice.
> > },
> >
> > But with VSH_OT_ALIAS, auto complete could also get it.
>
> Command line completion is orthogonal. It needs fixing anyways (there
> were patches posted last month, but I haven't seen any recent action on
> them).
>
> Ideally, we want the following:
>
> attach-disk <TAB>
>
> to NOT show --shareable (because it can show --mode instead)
>
> attach-disk --sh <TAB>
>
> would show --shareable (just because it's deprecated and hidden by
> default does NOT mean it must be hidden if the user explicitly requests
> something that can't complete in any other way)
>
> attach-disk --mode=shareable --sh<TAB>
> attach-disk --mode readonly --sh<TAB>
>
> would both complain about no possible completion (because --shareable
> has already been eliminated by --mode appearing earlier).
>
> attach-disk --shareable --mo<TAB>
>
> would complain about no possible completion (--shareable implies
> --mode=shareable, and --mode can't appear more than once).
>
> But getting that working in this patch series is NOT a prerequisite -
> save it for everything else that needs fixing with completion.
>
Thanks for your elaborate explanation.
I'll try to reach these goals, although they're a little complex.
> > We still need new flag to hide it.
>
> I'm still not convinced we need VSH_OFLAG_IGNORE. VSH_OT_ALIAS, plus
> new logic that lets a boolean be an alias to non-bool=value, ought to be
> the way to do it (ie. fix our existing aliasing mechanism, rather than
> adding a second aliasing mechanism).
>
Agree.
I'll try to expand the logic of VSH_OT_ALIAS.
Thanks!
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list