Sha256: 969a2002d23dc7238c38cc314e977f1f03c448fd6bdaff48d8c327822702bda6

Contents?: true

Size: 552 Bytes

Versions: 17

Compression:

Stored size: 552 Bytes

Contents

#! /usr/bin/env ruby

# A simple Clamp command, with options and parameters

require "clamp"

class SpeakCommand < Clamp::Command

  self.description = %{
    Say something.
  }

  option "--loud", :flag, "say it loud"
  option ["-n", "--iterations"], "N", "say it N times", :default => 1 do |s|
    Integer(s)
  end

  parameter "WORDS ...", "the thing to say", :attribute_name => :words

  def execute

    the_truth = words.join(" ")
    the_truth.upcase! if loud?

    iterations.times do
      puts the_truth
    end

  end

end

SpeakCommand.run

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
clamp-0.5.1 examples/speak
clamp-0.5.0 examples/speak
clamp-0.4.0 examples/speak
jls-clamp-0.3.1.2 examples/speak
jls-clamp-0.3.1 examples/speak
clamp-0.3.1 examples/speak
clamp-0.3.0 examples/speak
clamp-0.2.3 examples/speak
clamp-0.2.2 examples/speak
clamp-0.2.1 examples/speak
clamp-0.2.0 examples/speak
clamp-0.1.8 examples/speak
clamp-0.1.7 examples/speak
clamp-0.1.6 examples/speak
clamp-0.1.5 examples/speak
clamp-0.1.4 examples/speak
clamp-0.1.3 examples/speak