[libvirt] [PATCH] vsh: print help more often
Peter Krempa
pkrempa at redhat.com
Wed Oct 21 11:19:31 UTC 2015
On Wed, Oct 21, 2015 at 10:48:13 +0200, Michal Privoznik wrote:
> So, consider following scenario:
>
> virsh # migrate --help
>
> In this case migrate help is printed out. So far so good.
> However, you start writing this long migrate command (I bet you
> know the arguments there can get quite long), but then, at some
> point you need to print out the help. Something like this:
>
> virsh # migrate --copy-storage-all --migrate-disks --help
>
> In this specific case you just want to see the format that
> --migrate-disks accepts. So you append --help and expect help to
> be printed out. Well, it will not, because "--help" is taken as
> data to --migrate-disks. Therefore we will get this error
> instead:
>
> virsh # migrate --copy-storage-all --migrate-disks --help
> error: command 'migrate' requires <domain> option
> error: command 'migrate' requires <desturi> option
>
> Teach our parsing code, that --help may occur even in argument
> data, and therefore anywhere on the command line.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> tools/vsh.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
The following then won't be possible:
$ virsh start --domain --help
Domain --help started
$ virsh list
Id Name State
----------------------------------------------------
2 --help running
$ virsh destroy --domain --help
Domain --help destroyed
If you are curious whether such config is actually valid ...
# virt-xml-validate /etc/libvirt/qemu/--help.xml
/etc/libvirt/qemu/--help.xml validates
Since the schema looks like:
<define name="domainName">
<data type="string">
<!-- Use literal newline instead of \n for bug in libxml2 2.7.6 -->
<param name="pattern">[^
]+</param>
</data>
</define>
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151021/4264d79f/attachment-0001.sig>
More information about the libvir-list
mailing list