Sha256: f3390523055f1bf306aa3690e2fa0d9819f78a069745acda59f078fb112e738e

Contents?: true

Size: 1021 Bytes

Versions: 5

Compression:

Stored size: 1021 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

require "pp"
require "optparse"
require "rubygems"
require "tefil"

# option analysis
OPTIONS = {}
op = OptionParser.new
op.banner = [
  "Usage: #{File.basename("#{__FILE__}")} old_width new_width [options] [files]",
  "Example: #{File.basename("#{__FILE__}")} 4 2 [options] [files]",
].join("\n")
op.on("-o"     , "--overwrite"     , "Overwrite."){    OPTIONS[:overwrite] = true}
#op.on("-m", "--minimum", "Show only minimum indent (not zero)."){ OPTIONS[:minimum] = true}
#op.on("-l"     , "--left-alline"   , "Left alline."){ OPTIONS[:left] = true}
op.parse!(ARGV)

#数値として識別できない文字列(to_i で 0 になる)はタブにする。
num = ARGV.shift.to_i
if num == 0
  old_char  = "\t"
  old_width = 1
else
  old_char  = ' '
  old_width = num
end

num = ARGV.shift.to_i
if num == 0
  new_char  = "\t"
  new_width = 1
else
  new_char  = ' '
  new_width = num
end

f = Tefil::IndentConverter.new(old_char, old_width, new_char, new_width, OPTIONS)
f.filter(ARGV)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tefil-0.1.5 bin/indentconv
tefil-0.1.4 bin/indentconv
tefil-0.1.3 bin/indentconv
tefil-0.1.2 bin/indentconv
tefil-0.1.1 bin/indentconv