Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thor - Building CLI with ruby

Mann
September 08, 2012

Thor - Building CLI with ruby

Create command-line interface with thor

Mann

September 08, 2012
Tweet

More Decks by Mann

Other Decks in Programming

Transcript

  1. A rails app is a ruby app. A ruby app

    may NOT be a rails app.
  2. Multiple commands desc "hi", "Say hi" def hi puts "hi

    !" end desc "bye", "Say goodbye" def bye puts "bye !" end
  3. Parsing options desc "hello NAME", "Say hello to <NAME>" method_options

    loudly: false def hello(name) name.upcase! if options[:loudly] puts "hello #{name}!" end