Sha256: 7ca4468bd1d4e9c695fcf016c1426d1ccc4623768176ea7bf7cc9b37f06ef327
Contents?: true
Size: 646 Bytes
Versions: 1
Compression:
Stored size: 646 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require "filerenamer/filerenamer.rb" require "filerenamer/filerenameroptionparser.rb" OPTIONS = {} op = FileRenamerOptionParser.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 files = ARGV old_str = /#{old_str}/ if OPTIONS[:regexp] fr = FileRenamer.new(op.options) fr.execute(files) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
filerenamer-0.0.2 | bin/rensub |