Sha256: 21ce7f08d83bf72e171c6334bd8af103f3403b6a0ff9e924f65f3961a443cf04

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 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__}")} old_str new_str [options] [files]",
].join("\n")
op.on("-o"    , "--overwrite"    , "Overwrite."){    options[:overwrite] = true}
op.on("-g"    , "--global"    , "Globally substitute."){    options[:global] = 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

1 entries across 1 versions & 1 rubygems

Version Path
tefil-0.1.1 bin/linesub