miniparse is an easy to use yet flexible and powerful Ruby library for parsing command-line options.
Miniparser works pretty simply. You pass the Gem some input (HTML, JS, or CSS), and it will validate it, return the validated status, then minify it, and return the minified version as either a file (path) and a text return, respective to what input it got