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