swong15/shim — pull request #9 by m45t3r (2014-03-28 22:58:22+00:00)
Title: Argparser

Optparse is deprecated since Python 2.7 (see
http://docs.python.org/2/library/optparse.html). Argparse have a
similar usage but is much more robust (i.e., it don't allow positional
option without declaring it first). The only problem is that Argparse
was released on Python 2.7 (and Python 3.2 if I am not mistaken),
but Python 2.7 is already 4 years old so who cares ;) .

I made the options more robust too, making every argument optional and
exclusive (since this is how the code was, using if/else if/else for
each option), so the user is not confused (i.e. if he tries to use more
than a option the parser gives the proper error instead of allowing
shim to run but only executing the option with higher priority).

Finally, we inform the user how to use the program instead of just
printing a "failure!" message if he runs shim without any option (like
someone posted on Reddit).