vll 0.1.8 → 0.1.9

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/vl +11 -0
  2. metadata +1 -1
data/bin/vl CHANGED
@@ -18,6 +18,7 @@ $options = {
18
18
  :justify => 'l',
19
19
  :alternate_color => false,
20
20
  :chop_length => 1024,
21
+ :max_n_cols => 200,
21
22
  }
22
23
 
23
24
 
@@ -78,6 +79,10 @@ opts = OptionParser.new do |opts|
78
79
  $options[:alternate_color] = c
79
80
  end
80
81
 
82
+ opts.on('-m', '--max-num-cols <INT>', 'the maximum number of columns to show [200]') do |m|
83
+ $options[:max_n_cols] = m.to_i
84
+ end
85
+
81
86
  opts.on('-l', '--chop-length <INT>', 'chop columns longer than this length [1024]') do |l|
82
87
  $options[:chop_length] = l.to_i
83
88
  end
@@ -134,6 +139,12 @@ def print_line(line, lnum)
134
139
  # damn you, 'csv' package!
135
140
  parsed_line = [] if parsed_line == nil
136
141
  parsed_line.each_with_index do |c, i|
142
+ break if i > $options[:max_n_cols]
143
+ if i == $options[:max_n_cols] then
144
+ print "... #{parsed_line.size - i} more columns"
145
+ break
146
+ end
147
+
137
148
  # damn you, 'csv' package!
138
149
  c = '' if c == nil
139
150
  c = c.inspect[1..-2]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: vll
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.8
5
+ version: 0.1.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - xzhu