Re: [PATCH 1/3] virt-xml-validate: add --help/--version option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
From: "Eric Blake" <eblake@xxxxxxxxxx>
Cc: libvir-list@xxxxxxxxxx
Sent: Monday, August 19, 2013 6:58:56 PM
Subject: Re:  [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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]