All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Wray <mike.wray@hpl.hp.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
Cc: Steven Hand <Steven.Hand@cl.cam.ac.uk>, xen-devel@lists.sourceforge.net
Subject: Re: xm create option parsing..
Date: Fri, 30 Jul 2004 14:41:57 +0100	[thread overview]
Message-ID: <410A5025.80303@hpl.hp.com> (raw)
In-Reply-To: <E1BqUAU-0002CP-00@mta1.cl.cam.ac.uk>

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]

Mike


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com

  reply	other threads:[~2004-07-30 13:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-28 16:37 xm create option parsing Steven Hand
2004-07-28 16:45 ` Tom Wilkie
2004-07-28 17:10   ` Ian Pratt
2004-07-28 17:16     ` Tom Wilkie
2004-07-30  8:19 ` Mike Wray
2004-07-30  8:42   ` Steven Hand
2004-07-30  8:49   ` Ian Pratt
2004-07-30  9:08     ` Mike Wray
2004-07-30  9:16       ` Mike Wray
2004-07-30  9:59         ` Ian Pratt
2004-07-30 13:41           ` Mike Wray [this message]
2004-07-30  9:53       ` Ian Pratt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=410A5025.80303@hpl.hp.com \
    --to=mike.wray@hpl.hp.com \
    --cc=Ian.Pratt@cl.cam.ac.uk \
    --cc=Steven.Hand@cl.cam.ac.uk \
    --cc=xen-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.