RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in