Created
September 10, 2012 02:24
-
-
Save lchanmann/3688473 to your computer and use it in GitHub Desktop.
hello thor cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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