Sha256: c81f03ebf0b7432e94c74dd9978d3475d0bdc57b06039cca4767950a10301392

Contents?: true

Size: 493 Bytes

Versions: 6

Compression:

Stored size: 493 Bytes

Contents

#! /usr/bin/env ruby

# A simple Clamp command, with options and parameters

require "clamp"

Clamp do

  banner %(
    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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clamp-1.2.1 examples/speak
clamp-1.2.0 examples/speak
clamp-1.2.0.beta1 examples/speak
clamp-1.1.2 examples/speak
clamp-1.1.1 examples/speak
clamp-1.1.0 examples/speak