On Colorized Output - Get Comfortable with OptionParser
In this article I demonstrate how to make colorized output configurable using OptionParser. This is a followup to my last post about writing pipeline-aware Ruby scripts. I also add a few other configurable options and show some best practices.
Comments
Once again, awesome article. Not many people know that OptionParser has the ability to validate and coerce option values. You can even define your own custom option types (ex: https://github.com/postmodern/parameters/blob/0.4.0/lib/parameters/options.rb#L199-209).
Post a comment