From: Perl Junkie Date: 2011-09-29T23:51:24+09:00 Subject: Re: Looking for better/familiar approach to command line opts Robert Klemme wrote in post #1024201: > On Wed, Sep 28, 2011 at 6:25 PM, Perl Junkie > wrote: > >>Someone else posted a solution, and I appreciate it, but >> no time to look at it. > > Really? We're talking about 20 lines for an implementation that uses > an option specification format pretty similar to your original format. I post a question, someone takes the time to answer it, but I don't look at it. Didn't seem fair. :-) I looked. I liked. Very nice. I like how you took the approach to extend the existing class and it was simple yet elegant. Kudos. I'm glad I looked today. >> Thanks all. I think this has been completely cracked and solved. >> Exactly as I would like plus a clear(er) OptionParser example. > > Did you check the example in OptionParser's documentation? I did, but frankly, it still doesn't make sense to me do it that way. I'm used to defining the command line options as I have before and I get a specific class instance like magic that just does what I want. I didn't want to build a specific class by hand, which is how OptionParser still strikes me somewhat. But... this kind of thinking can be an impediment to really learning something new -- trying to do something in one language "like" you did in another. So that has to be taken into consideration. (Then again, another language can help pick and point out unnecessary implementations in another language. This is why I have Java, because it has such high, time-consuming overhead. Wanting to "do it better" is what got Ruby started in the first place.) I think your solution was a perfect middle ground. Thanks for the time you took and it's a great overall contribution to Ruby, doing it the Ruby way, outside of just my question. -pj -- Posted via http://www.ruby-forum.com/.