[libvirt] [PATCH 1/3] virt-xml-validate: add --help/--version option
Guan Nan Ren
gren at redhat.com
Tue Aug 20 01:51:51 UTC 2013
----- Original Message -----
From: "Eric Blake" <eblake at redhat.com>
Cc: libvir-list at redhat.com
Sent: Monday, August 19, 2013 6:58:56 PM
Subject: Re: [libvirt] [PATCH 1/3] virt-xml-validate: add --help/--version option
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 -
grep use "grep -f -" to donate the standard input. As written in its manpage
-f is specified by POSIX. If we use -f, the single hyphen can be used
as a filename. But as you said in the follow, user can prefix the filename
with a path - ./-, or /home/Tim/-, so it is still fine in this case.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
--
libvir-list mailing list
libvir-list at redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
More information about the libvir-list
mailing list