---
title: "Notes from Build Awesome Command-Line apps"
description: "Lately I was going through book and talks on ’Build Awesome Command-Line Applications in Ruby: Control Your Computer in JS."
url: "https://h3manth.com/scribe/notes-from-build-awesome-command-line-apps/"
canonical_url: "https://h3manth.com/scribe/notes-from-build-awesome-command-line-apps/"
markdown_url: "https://h3manth.com/scribe/blog/notes-from-build-awesome-command-line-apps.md"
publishDate: "2012-05-19T00:00:00.000Z"
author: "Hemanth HM"
category: "ruby"
tags: ["ruby"]
word_count: 274
reading_time_minutes: 2
x_markdown_tokens: 493
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Notes from Build Awesome Command-Line apps

> Lately I was going through book and talks on ’Build Awesome Command-Line Applications in Ruby: Control Your Computer in JS.

Lately I was going through book and talks on "Build Awesome Command-Line Applications in Ruby: Control Your Computer, Simplify Your Life" by David Bryant Copeland.

Major stuff /me noted down from it are as below :

__The UNIX Way__

* grepable (One "record" perline)
* cutable (delimited "fieIds") 
* exit codes! (O for success, nonzero for failure)
* messaging (stderr) vs. output (stdout)

__Why Ruby?__

* High-level abstractions
* Still close to the metal (eg. FileUtils)
* Fast (no heavyweight VM to start up)
* Simple packaging/distribution with RubyGems

__Ruby, The Ecosystem__

* CLI is part of the culture 
* Great open-source gems for command-line
* Great open-source gems for everything else

__How you should do it__

* Check exit codes - plays well! 
* Log the command helpful! 
* Capture the output - helpful!
* Check exit codes plays well! 
* Log the command helpful! 
* Capture the output- helpful!
* Think of "future you"

__Few CIL gems I liked :__

* Rainbow - Create colored output
* Thor - Create a command-suite app simply and easily, as well as Rails generators
* GLI - Create awesome, polished command suites without a lot of code
* Slop - Create simple command-line apps with a syntax similar to trollop.
* Childprocess - Cross-platform ruby library for managing child processes
* Formatador - produce rich output with a tag-like string syntax, including tables and progressbars
* Highline - handle user input and output via a “Q&A” style API, including type conversions and validation

All in All it's a pretty decent read and will help one getting started and running CLI apps in a wink ;)
