This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] xm create option parsing..

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] xm create option parsing..
From: Mike Wray <mike.wray@xxxxxxxxxx>
Date: Fri, 30 Jul 2004 14:41:57 +0100
Cc: Steven Hand <Steven.Hand@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 30 Jul 2004 14:42:43 +0100
Envelope-to: Steven.Hand@xxxxxxxxxxxx
In-reply-to: <E1BqUAU-0002CP-00@xxxxxxxxxxxxxxxxx>
References: <E1BqUAU-0002CP-00@xxxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040421
Ian Pratt wrote:

Each subcommand is responsible for parsing its own options, so
we could get 'xm create' etc. to allow options after the args.
I'll make the change.

Oops. The gnu-style getopt parsing is a Python 2.3 feature - not
available in 2.2. So we can't enable it at the moment.

That's a bind. I'm going to have to cave in and switch to 2.3 at
some point, but I'd like to hold out for a while longer.

'create' is the only sub command that really suffers from this,
so could we just temporally hack the parsing to call getopt again
on the arguments[1:] and append to the list? Not pretty, but...

It's worse than that - because getopt bails on the first non-option
we have to keep on calling it iteratively. Might as well write
your own getopt :-). The way out is to go with 2.3 and use gnu_getopt
or do some backport hack for the code for 2.3 to 2.2.
In the meantime just document that the format is
command [options] [args]