[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: WANTED: POSIX compatible getopt
- From: David Manura <dm.lua@...>
- Date: Fri, 9 Jan 2009 21:50:39 -0500
On Fri, Jan 9, 2009 at 12:06 PM, Fabien wrote:
> Metalua has a fairly complete options parser, accessible here
The main link for Lua command line parsing implementations is [1].
The code I've been using recently (for Lua ports of patch and gunzip
utilities) is Lua optparse, available from [1], whose interface is
based on Python's optparse[2-3]. The reason for mirroring optparse
was that I thought the large Python community should have flushed out
a proper design for a command line parser by now (optparse is even the
second generation), the design should apply nearly as well to Lua, and
many users may already be familiar with the Python interface. On the
downside, only the functions I've needed for particular projects have
been implemented. However, other users are welcome to rectify that :)
I agree that a robust, complete command-line parsing implementation in
Lua is called for though. Generally I think this involves one person
spending significant time to get it right rather than many people
doing partial work in different directions (as I did). Perhaps the
optparse interface is good enough for the sake of argument, or perhaps
there is something better.
[1] http://lua-users.org/wiki/CommandLineParsing
[2] http://docs.python.org/lib/optparse-defining-options.html
[3] http://blog.doughellmann.com/2007/08/pymotw-optparse.html