[gobolinux-devel] [gobolinux-commits] tools/Scripts/Functions OptionParser
Hisham Muhammad
hisham.hm at gmail.com
Mon Nov 20 01:54:23 UTC 2006
On 11/19/06, Jonas Karlsson <jonka750 at student.liu.se> wrote:
> I've just commited my new implementation of OptionParser. The new
> functionallity can be found in the short log, but I thought I might give
> some examples to clear things up. Using Compile as an example, valid calls
> are:
>
> Compile -bS Foo
> Compile Foo --no-sign
> Compile -VnFooBar --version=2.3 Foo
> Compile -xppc Foo
> Compile -bGc"--no-app --without-lib" Foo
>
> For the arguments there are a new array, $Arg, to be used instead of $1,
> $2 in combinations with shift. $Arg[0] is the same as $0 and then the
> arguments are numbered in the order of appearance.
>
> Even though there's a new way of accessing arguments this commit didn't
> break the old one, but people should try to change the way arguments are
> handled in the existing scripts, using $Arg instead of $1 etc.
>
> Questions, views, objections? - Please! :)
Ok, here go my questions, views and objections:
* First of all, if this is in, then _all_ scripts have to be changed
to use $Arg. As it stands, it is advertising broken functionality, as
"Compile Foo --batch 2.0" does not work.
* While I did tell you offlist that I thought the new option parser is
a great addition, I think you should have posted this on the -devel
list before comitting, since it's a big change that affects all
scripts.
* I have restrictions wrt stacking short arguments and using them with
entry values. Things like "-xbla" look ambiguous.
* Using `Arg 1` instead of ${Arg[1]} looks cleaner (a matter of
taste), more consistent with the rest of the option parser. I concede
it's less efficient, but they shouldn't be used a lot anyway: they're
meant to be assigned to variables with meaningful names instead of
being referred through numbers.
Hope I didn't sound too harsh. I think revamping the option parser is
a great work which will be appreciated by all users! (me included)
But you _did_ ask for objections... ;)
-- Hisham
More information about the gobolinux-devel
mailing list