summaryrefslogtreecommitdiff
path: root/bin/process-spaces
blob: 23cab6759df635e4191879b7b3a8bf33b453d39a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env ruby

require 'optparse'

nspaces = 4

OptionParser.new do |opts|
  opts.on('-s SPACES', '--spaces=SPACES', 'Number of spaces') do |s|
    nspaces = s.to_i
  end
end.parse!

while (l = gets)
  print l.gsub(/^(\t*)( {#{nspaces}})/, "\\1\t")
end