sajad torkamani

What is Thor?

Thor is a Ruby gem that helps you build command-line utilities. It’s used in projects like Rails, Bundler, and Vagrant.

Recipes

Catch exceptions

Wrap the CLI.start call in a begin/rescue block. Something like:

#!/usr/bin/env ruby

require 'sajad/cli'

begin
  Sajad::CLI.start
rescue Sajad::ConfigError => e
  $stderr.puts e.message
end

Sources

Leave a comment

Your email address will not be published. Required fields are marked *