Sha256: 7d141e2e1fe01fa2becdd7e14017bbb3c156155dc2786e65a2e842335b551614

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

#! /usr/bin/env ruby

require "clamp"

class Rename < Clamp::Command

  usage "[OPTIONS] TRANSFORM FILE ..."

  parameter "TRANSFORM", "a Ruby expression"
  parameter "FILE", "a file to rename"
  
  option ["-v", "--verbose"], :flag, "be verbose"

  option ["-n", "--times"], "TIMES", "repetitions" do |n|
    n = Integer(n)
    raise ArgumentError, "too big" if n > 9
    n
  end

  def initialize(name)
    super
    @times = 1
  end
  
  def execute
    @times.times do
      puts "Blah blah blah" if verbose?
    end
  end
  
end

Rename.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clamp-0.0.9 examples/rename