ix-cli 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ix-prepend +0 -0
- data/bin/ix-string-similarity +21 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb14cdf843c9b38f5aa771f23334ee0bb58ebcc6cd138c56ce2af5d02fbe283d
|
4
|
+
data.tar.gz: b09c43e5a377df98063a481d8ccefc95ee698b5fbee9416e95e5e9b6e19eb9bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daef124c711c4365df35f28c2366c8f0cab9a3e83110eb2574ccee83298fef06637e1ba183b31a65e4b6c03a79f412cc9308f2fd0769d74d01fa2d078d48e0d1
|
7
|
+
data.tar.gz: 16807bada66a3cbd525e2cdb7b5726e9b2457bb05b392dbabde129d42e6f808309c6b065a6fa1c4f72a222a55952bc551ec4a35ef51edef49bb33e29b8c37223
|
data/bin/ix-prepend
CHANGED
File without changes
|
data/bin/ix-string-similarity
CHANGED
@@ -81,6 +81,10 @@ OptionParser.new do |opts|
|
|
81
81
|
options[:threshold] = value.to_f
|
82
82
|
end
|
83
83
|
|
84
|
+
opts.on('-s', '--summary', 'Print Summarized version.') do |value|
|
85
|
+
options[:summary] = value
|
86
|
+
end
|
87
|
+
|
84
88
|
end.parse!
|
85
89
|
|
86
90
|
required_options = [:threshold]
|
@@ -157,12 +161,15 @@ end
|
|
157
161
|
|
158
162
|
require 'isna'
|
159
163
|
|
164
|
+
summary_output = []
|
165
|
+
detailed_output = []
|
166
|
+
|
160
167
|
banner = Template::Banner.new
|
161
168
|
banner.lines = lines.to_s.to_ansi.yellow.to_s
|
162
169
|
banner.groups = hash.keys.size.to_s.to_ansi.yellow.to_s
|
163
170
|
banner.threshold = options[:threshold].to_s.to_ansi.yellow.to_s
|
164
171
|
banner.datetime = Time.now.to_s.to_ansi.yellow.to_s
|
165
|
-
|
172
|
+
summary_output.push(banner.to_s)
|
166
173
|
|
167
174
|
groups = []
|
168
175
|
|
@@ -179,14 +186,15 @@ end
|
|
179
186
|
sorted_groups_by_n_records_asc.reverse.each_with_index do |key, index|
|
180
187
|
line, records = key[0], hash[key[0]]
|
181
188
|
|
182
|
-
|
189
|
+
detailed_output.push('')
|
183
190
|
|
184
191
|
group = Template::Group.new
|
185
192
|
group.percent = ('%2.2f%%' % ((records.size.to_f / lines) * 100)).to_s.to_ansi.red.to_s
|
186
193
|
group.number = (index + 1).to_s.to_ansi.red.to_s
|
187
194
|
group.items = records.size.to_s.to_ansi.cyan.to_s
|
188
195
|
group.line = line.chomp.to_ansi.green.to_s
|
189
|
-
|
196
|
+
summary_output.push(group.to_s)
|
197
|
+
detailed_output.push(group.to_s)
|
190
198
|
|
191
199
|
sorted_items_in_group = records.sort do |a, b|
|
192
200
|
a[:score] <=> b[:score]
|
@@ -198,8 +206,17 @@ sorted_groups_by_n_records_asc.reverse.each_with_index do |key, index|
|
|
198
206
|
item.total = records.size.to_s.ljust(4, ' ').to_ansi.cyan.to_s
|
199
207
|
item.score = ('%4.2f%%' % (record[:score] * 100)).rjust(7, ' ').to_ansi.green.to_s
|
200
208
|
item.line = record[:line]
|
201
|
-
|
209
|
+
detailed_output.push(item.to_s)
|
202
210
|
end
|
203
211
|
|
204
212
|
end
|
205
213
|
|
214
|
+
summary_output.each do |output_line|
|
215
|
+
puts output_line
|
216
|
+
end
|
217
|
+
|
218
|
+
unless options[:summary]
|
219
|
+
detailed_output.each do |output_line|
|
220
|
+
puts output_line
|
221
|
+
end
|
222
|
+
end
|