]> xenbits.xensource.com Git - libvirt.git/commit
virsh: add option aliases
authorEric Blake <eblake@redhat.com>
Fri, 2 Mar 2012 18:01:15 +0000 (11:01 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 8 Mar 2012 01:24:44 +0000 (18:24 -0700)
commit1c56b9fe5360acb6a5be65b85159135fc5d82498
treed9f28518c426aaac2fbe62c5b52237faa9ff1eb0
parent2e22f23bde0ad6630a29d06ce164b6db8395f72c
virsh: add option aliases

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.
* tools/virsh.pod (NOTES): Document promise of back-compat.
* tests/virshtest.c (mymain): Test new feature.
tests/virshtest.c
tools/virsh.c
tools/virsh.pod