On 08/19/2013 04:43 PM, Eric Blake wrote: > All good tools should have --help and --version output :) > > * tools/virt-xml-validate.in: Add option parsing. Output errors > to stderr. Update documentation to match. > * tools/Makefile.am (virt-xml-validate): Substitute version. > > + --) shift ;; > + -*) > + echo "$0: unrecognized option '$1'" >&2 > + exit 1 ;; > +esac > + > XMLFILE="$1" This treats '-' as an unrecognized option (which is a bit misleading, since in POSIX terminology a lone - is NOT an option but an argument). It also raises the question - should we allow for an XMLFILE of '-' to mean reading from stdin, the way POSIX recommends? That is, should we support: virsh dumpxml $dom | virt-xml-validate - as a valid mode of execution? Right now, that won't work (we consume stdin while probing the type, so that it no longer has contents for the actual validation pass), so it would need a separate patch to make the shell script smarter about reusing an input file, which may turn out to be a fair chunk of work before we get there (and it would probably be me stuck implementing it...). And if '-' works to specify stdin, why not also let this tool operate in filter mode (no arguments implies reading from stdin, just as an explicit - would). I guess the fact that I changed '-' to raise an error in this patch is a minor change for people used to using '-' as the name of a file in the current directory; but as that is not typical usage, and as they can work around that by using './-', I don't consider it a regression [but I _will_ update the commit message to mention that this is an intentional change in corner-case behavior] -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list