Don't.

Just use Trollop.

Seriously. Don't even think. Just obey.

OBEY.

Don't write a "framework" to do it. Don't write an overly-pedantic DSL.
Don't write a complicated OO system where for some INSANE reason you
decide that inheritance NATURALLY should be a critical component of
parsing the commandline.

That kind of behavior is NOT acceptable.

If I have to write more than one line of code per option, you're doing
it wrong. If I have to think about it, you're doing it wrong. If I have
to SUBCLASS something, for crying out loud, you're doing it VERY wrong.

But don't worry about it. Don't fret. I've already done it right, just
for you. With Trollop.

I have been perfecting Trollop for over three years. OVER THREE YEARS.
That probably makes it the longest-lived project in all Ruby history.
Trollop is not just epic. It is EPOCH. It is ART. It is PURE. And it is
1.9-compatible.

Seriously, people. What is it about option parsing that makes you go
crazy like this?
-- 
William <wmorgan-ruby-talk / masanjin.net>