Sha256: 09cf77ea53e7460a0ae81be8b199c38153bc1e7e4132e4283a6c6c2862a2530f
Contents?: true
Size: 632 Bytes
Versions: 7
Compression:
Stored size: 632 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require "filerenamer/commander.rb" require "filerenamer/optionparser.rb" OPTIONS = {} op = FileRenamer::OptionParser.new op.on("-g", "--global", "Global substitution."){ OPTIONS[:global] = true } op.on("-r", "--reg-exp", "Regular expression."){ OPTIONS[:regexp] = true } op.parse!(ARGV) old_str = ARGV.shift new_str = ARGV.shift old_str = /#{old_str}/ if OPTIONS[:regexp] fr = FileRenamer::Commander.new(op.options, ARGV) fr.execute do |filename| if OPTIONS[:global] new_name = filename.gsub(old_str, new_str) else new_name = filename.sub(old_str, new_str) end new_name end
Version data entries
7 entries across 7 versions & 1 rubygems