Skip to content

Instantly share code, notes, and snippets.

@lchanmann
Created September 10, 2012 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lchanmann/3688473 to your computer and use it in GitHub Desktop.
Save lchanmann/3688473 to your computer and use it in GitHub Desktop.
hello thor cli
require 'rubygems'
require 'thor'
class HelloCli < Thor
desc "hi", "Say hi"
def hi
puts "hi !"
end
desc "bye", "Say goodbye"
def bye
puts "bye !"
end
desc "hello NAME", "Say hello to <NAME>"
method_options loudly: false
def hello(name)
puts "hello #{options[:loudly] ? name.upcase : name}!"
end
end
HelloCli.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment