[libvirt] [PATCH 0/4] generate SYNTAX section of "virsh help CMD" output

Daniel Veillard veillard at redhat.com
Mon Dec 8 10:30:40 UTC 2008


On Fri, Dec 05, 2008 at 07:24:31PM +0100, Jim Meyering wrote:
> This started when I noticed that a lot of virsh help output was
> out of date.  Dan Berrange suggested to generate the SYNTAX line
> automatically based on existing option descriptions, since they tell us
> what arguments/types each command accepts and can (usually) tell us when
> options or arguments are optional.
> 
> Doing this exposed several inaccurate SYNTAX lines,
> as well as some inaccurate option descriptions.  But since
> the option description structs are currently used only
> to generate the text of ./virsh help's OPTIONS section,
> it's not terribly important.
> 
> Other than changes to help output, this change induces some
> minor user-visible changes:
> 
> It is currently undocumented that virsh accepts "-h C1 C2 C3..."
> and treats it like "virsh help C1", ignoring C2 C3...
> 
> This change disables that feature (to clean up a few interfaces and to
> make automatic help SYNTAX generation simpler) and makes virsh diagnose
> any unused arguments with --help (-h), so now, this command fails rather
> than trying to interpret "A" as a command:
> 
>   $ virsh -h -c test:///default A
>   virsh: error: extra argument 'A'. See --help.
> 
> To view the other changes induced by this patch, I've run the
> following commands:
> 
>   v='virsh -c test:///default'
>   cmd=$(eval $v help|sed -n 's/^    \([^ ][^ ]*\) .*/\1/p')
>   for i in $(echo $cmd); do
>     diff -ubBw -L $i.orig -L $i.new <(eval $v help $i) <(eval ./$v help $i)
>   done
> 
> They use diff to compare e.g., the output of my just-built ./virsh
> and the installed-in-PATH "virsh" program.
> 
> Note that there is currently no way via options to indicate that one
> of two or more options must be selected, so the automatically generated
> syntax string list both as independent options.
> 
> Here are the induced help changes:
> [code diffs coming in separate messages]

  Looks fine to me, all those diffs seems to fix errors in synopsis
or rename the arguments to be more coherent. I don't think breaking
the unspecified -h behaviour is a problem. So +1 from me !

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list