[libvirt] [PATCHv2 11/15] virsh: add option aliases

Eric Blake eblake at redhat.com
Wed Mar 7 21:04:26 UTC 2012


On 03/06/2012 10:46 AM, Peter Krempa wrote:
> On 03/06/2012 01:34 AM, Eric Blake wrote:
>> In the past, we have created some virsh options with less-than-stellar
>> names.  For back-compat reasons, those names must continue to parse,
>> but we don't want to document them in help output.  This introduces
>> a new option type, an alias, which points to a canonical option name
>> later in the option list.
>>
>> I'm actually quite impressed that our code has already been factored
>> to do all option parsing through common entry points, such that I
>> got this added in relatively few lines of code!
>>
>> * tools/virsh.c (VSH_OT_ALIAS): New option type.
>> (opts_echo): Hook up an alias, for easy testing.
>> (vshCmddefOptParse, vshCmddefHelp, vshCmddefGetOption): Allow for
>> aliases.
>> * tests/virshtest.c (mymain): Test new feature.
>> ---
> 
> Nice way to mask old mistakes and still support them.
> 
> I'm wondering if this will not confuse people if their beloved arguments
> disappear suddenly from the docs. Maybe the help command could
> explicitly state aliases that exist for commands to avoid some confusion.

I'll document the old name in the man page, but not in 'virsh help'.

> 
> I'm leaning towards an ACK as it's better to encourage to use the fixed
> spelling. Does anyone object?
> 
> Peter
> 
> 

-- 
Eric Blake   eblake at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120307/6cc8b16c/attachment-0001.sig>


More information about the libvir-list mailing list