Re: Re: required options

Robert Collins <[email protected]> Thu, 09 Sep 2004 20:26:39 +1000
Newsgroups gmane.comp.python.optik.user
Message-ID <1094725599.6971.27.camel@localhost>
On Thu, 2004-09-09 at 11:30 +0200, Thorsten Kampe wrote:
> On Thu, 09 Sep 2004 17:37:04 +1000, "Robert Collins"
> <[email protected]> said:
> > On Thu, 2004-09-09 at 09:27 +0200, Thorsten Kampe wrote:
> > > 
> > > 
> > > Yes, four arguments instead of two. Obviously an ugly, nonsensical
> > > "hack".
> > >  
> > > > if you want to do that, that is. I agree with the Tao though, if
> > > > something is mandatory, it is not an 'option'.
> > > 
> > > I agree with the Tao, too. But the whole point of my posting was that
> > > these people in fact don't want mandatory options but named arguments.
> > 
> > target=TARGET  ?
> 
> That's possible? Looks /good/. Could you give me some hints on how to do
> that?

With the stock (CVS), optik won't help you at all. Just process the
arguments and parse them with string logic.

With my branched optik code (which IIRC I've posted to this list about
how-to-get-it), you would subclass Argument to create a NamedArgument.
Then create a grammar like:
OneOf((NamedArgument('target'), NamedArgument('linkname'))), and pass
that to the option_parser.
 
> > Thats easy to do with the argument parser I have in my branch of optik.
> > Getting that into HEAD is a goal, but having got the benefit of it, I'm
> > not hacking on it hugely.
> 
> Probably the same thing with this "description" keyword: if it's not in
> the documentation noone will no it's there and noone will use it.

There is a difference: my code isn't in CVS at all: its only in my arch
archive, which is not what gets released :}.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQBBQC/fM4BfeEKYx2ERAp89AJ4kv3PBHlI9yKItbttv6hQu+PvSxwCfWoKL
2Iod50sBHcLvAD+/0drbD38=
=8kVJ
-----END PGP SIGNATURE-----