wstrip 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/bin/wstrip +7 -1
  2. metadata +1 -1
data/bin/wstrip CHANGED
@@ -9,9 +9,11 @@ class WStrip < TerminalRunner
9
9
  option "--help", 0, "", "Shows this help file."
10
10
  option "--recursive", 0, "", "Recursively get files from directories."
11
11
  option "--extension", 1, "<extension_list>", "Only apply to files with the specified extensions."
12
+ option "--remove-tabs", 1, "<amount>", "Replaces all tabs by the specified number of spaces."
12
13
 
13
14
  option_alias "--recursive", "-r"
14
15
  option_alias "--extension", "-e"
16
+ option_alias "--remove-tabs", "-t"
15
17
 
16
18
  help <<EOS
17
19
  Removes all extra whitespace from the end of lines.
@@ -61,7 +63,11 @@ EOS
61
63
  puts "Fixing #{file}"
62
64
  lines = []
63
65
  File.open(file, 'r').each_line do |line|
64
- lines << line.rstrip
66
+ new_line = line.rstrip
67
+ if @@options.include?("--remove-tabs")
68
+ new_line = new_line.gsub(/\t/, " " * @@options["--remove-tabs"][0].to_i)
69
+ end
70
+ lines << new_line
65
71
  end
66
72
  File.open(file, 'w') do |f|
67
73
  lines.each do |line|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wstrip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: