ANNOUNCE: Optik 1.0 (new command-line parsing library)
Oleg Broytmann
phd at phd.pp.ru
Mon Nov 12 10:32:04 EST 2001
Thank you! Looks nice!
On Mon, Nov 12, 2001 at 10:26:12AM -0500, Greg Ward wrote:
> > <yourscript> --file outfile1 -f outfile2
>
> Yes, but just what happens in this case depends on the action you use.
> I'm assuming --file and -f are synonomous, ie.
>
> parser.add_option("-f", "--file", ...)
>
> is how you defined them. If you did
>
> parser.add_option("-f", "--file",
> action="store", type="string", dest="file")
>
> then the most recent option seen takes effect, and
> options.file == "outfile2"
>
> But if you did
>
> parser.add_option("-f", "--file",
> action="append", type="string", dest="file")
>
> (note the different action), then all occurences of -f or --file build
> up, and
> options.file == ["outfile1", "outfile2"]
>
> In other words, you're free to define the Right Thing for your
> application, and Optik will Do The Right Thing. That's why I used
> "flexible" in the description.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list