[libvirt] [PATCH 5/5]virsh: mark '--shareable' as VSH_OFLAG_IGNORE

Eric Blake eblake at redhat.com
Tue Oct 22 06:22:53 UTC 2013


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.

>     },
> 
> 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.

> 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).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131022/d3bf398e/attachment-0001.sig>


More information about the libvir-list mailing list