libvirt/tools
Eric Blake b9973f526c virsh: fix regression in parsing optional integer
Regression introduced in 0.8.5, commit c1564268.  The command
'virsh freecell 0' quit working when it changed from an optional
string to an optional integer.

This patch introduces a slight change that specifying an option
twice is now detected as an error.  It also changes things so
that a command that has more than 1 required option will not
complain about missing options if one but not all of the options
were given in long format, as in 'virsh vol-create --pool p file',
as well as making positional parsing work for all optional
options (each positional argument is associated with the earliest
option that has not yet been seen by name).

Optional boolean options can appear before required argument
options, because they don't affect positional argument parsing,
and obviously a required boolean option makes no sense.

Technically, this patch renders VSH_OT_STRING and VSH_OT_DATA
redundant; but cleaning that up can be a separate patch.

No command should ever need more than 32 options, right? :)

* tools/virsh.c (vshCmddefGetData, vshCmddefGetOption)
(vshCommandCheckOpts): Alter parameters to use bitmaps.
(vshCmddefOptParse): New function.
(vshCommandParse): Update for better handling of positional
arguments.
(vshCmddefHelp): Allow unit tests to validate options.
2011-04-15 16:08:18 -06:00
..
.gitignore maint: track moved file 2010-08-31 10:00:31 -06:00
console.c virsh: Free stream when shutdown console 2011-03-14 15:11:03 +08:00
console.h Re-write virsh console to use streams 2010-11-11 16:03:20 +00:00
libvirt_win_icon_16x16.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt_win_icon_32x32.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt_win_icon_48x48.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt_win_icon_64x64.ico Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
libvirt-guests.init.sh libvirt-guests: implement START_DELAY 2011-04-15 11:15:06 -06:00
libvirt-guests.sysconf libvirt-guests: implement START_DELAY 2011-04-15 11:15:06 -06:00
Makefile.am virsh: Remove indirect link against libxml2 2011-03-08 21:28:57 +01:00
virsh_win_icon.rc Move virsh into tools/ directory 2009-09-21 14:41:45 +01:00
virsh.c virsh: fix regression in parsing optional integer 2011-04-15 16:08:18 -06:00
virsh.pod docs: document freecell --all 2011-04-11 08:32:37 -06:00
virt-pki-validate.in virt-*-validate.in: quote all variable references 2011-02-21 10:32:34 -07:00
virt-xml-validate.in virt-*-validate.in: quote all variable references 2011-02-21 10:32:34 -07:00