allomov
1/14/2015 - 1:59 PM

Simple BOSH CLI plugin that magically says hello

Simple BOSH CLI plugin that magically says hello

require "bosh/magic"

module Bosh::Cli::Command
  class Magic < Base
    include Bosh::Magic::Helpers

    usage "say hello"
    desc "simple BOSH CLI plugin"
    option "--loud", "Say loudly"
    option "--repeat some_number", Integer, "The number of times to repeat"
    option "--optional [parameter]", String, "Optional string parameters"
    def perform(name)
      n = options[:repeat] || 1
      phrase = "Hello, #{name.capitalize}!"
      phrase.upcase! if options[:loud]
      n.times do
        say phrase.make_green
      end      
    end

  end
end