#!/usr/bin/env ruby

begin
  require 'orly'
rescue LoadError
  require 'rubygems'
  require 'orly'
end

include Orly

Choice.options do

  header "Orly notifies you whenever you pull an update that requires 'bundle install' or 'rake db:migrate'"

  option :install do
    short '-i'
    long "--install"
    desc "install orly for this git repo"
    action { Orly::Installation::install() }
  end

  option :uninstall do
    short '-u'
    long "--uninstall"
    desc "uninstall orly for this git repo"
    action { Orly::Installation::uninstall() }
  end

  option :run do
    short '-r'
    long "--run"
    desc "run orly now"
    action { Orly::run() }
  end

  option :speak do
    short '-s'
    long "--speak"
    desc "makes the O RLY owl talk"
    action do |value|
      value = "YA RLY" if value == true
      Orly::OwlPrinter.print(value.split("\n"))
    end
  end

end

Choice.help if Choice.choices.empty?