Sha256: 636249bc9f0f416b5343b57e2989d9356f666f29cf127235c1ba71f7986ff0f9

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

#! /usr/bin/env ruby

require "clamp"

class Rename < Clamp::Command

  usage "[OPTIONS] TRANSFORM FILE ..."

  argument "TRANSFORM", "a Ruby expression"
  argument "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

  help_option
  
  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.1 examples/rename