From: Joel VanderWerf Date: 2007-09-07T08:21:14+09:00 Subject: Re: minimalistic command line option parsing via -s Ari Brown wrote: > > On Sep 6, 2007, at 11:55 AM, Joel VanderWerf wrote: > >> It's nice to have that for very short scripts, but for about 50 LOC >> you can paste in an options parser that permits --foo style options, >> -xyz as an alias for "-x -y -z", option arguments, argument conversion >> procs and defaults, "-x123" as an alias for "-x 123", and even a way >> to interpret "-v -v -v" as thrice verbose. One thing you can't have is >> _optional_ arguments to options (e.g. an option that takes 0 or 1 >> arguments). > > > A really nice tool I stumbled on while e-stalking Ara Howard (hehe > sorry) was his main library (gem install main). He's got some example > code of it on his site, and it makes options really really easy! Just took a look at it... very powerful. It handles arguments (things without -- or -) as well as options. It's also fairly complex, and not the sort of thing you paste into a small script (almost 2000 lines). Main looks like more of a complete framework for CLI (possibly like the commandline gem--has anyone compared these two?). By contrast, argos does just one thing: turn an arg string into a hash, based on a spec. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407