Sha256: b0ac6bcc9dc0b7222672d64fb2ce46acdc9a6af1ee5a36458c74d74aa676637f
Contents?: true
Size: 772 Bytes
Versions: 2
Compression:
Stored size: 772 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 # # USAGE: linesub [options] str0 str1 files ... require "pp" require "optparse" require "rubygems" require "tempfile" #gem "tefil" require "tefil.rb" ## option analysis options = {} op = OptionParser.new op.banner = [ "Usage: #{File.basename("#{__FILE__}")} [options] old_str new_str [files]", ].join("\n") op.on("-o" , "--overwrite" , "Overwrite"){ options[:overwrite] = true} op.on("-g" , "--global" , "Globally substitute"){ options[:global] = true} op.on("-r" , "--reg-exp" , "Regular expression for old_str"){ options[:regexp] = true} op.parse!(ARGV) old_str = ARGV.shift new_str = ARGV.shift options[:overwrite] ||= false tf = Tefil::LineSubstituter.new(old_str, new_str, options) tf.filter(ARGV)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tefil-0.1.3 | bin/linesub |
tefil-0.1.2 | bin/linesub |