Formatting Output with Tables

In Chapter 4, Play Well with Others, we discussed using CSV format to organize output, where each line would represent a record and each comma-separated value would represent a field. We even updated todo to use this format to make it easier to integrate with other programs. Humans have a hard time reading CSV-formatted data, instead finding it easier to view such data in a tabular format. This is why spreadsheet programs like Microsoft Excel can import CSV files and display their data in tables. It’s also why most SQL database clients show their output in tables; it’s a great way to look at a lot of data in an organized fashion.

Using the gem terminal-table, it’s very easy to produce tabular output from our ...

Get Build Awesome Command-Line Applications in Ruby 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.