vll 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/vl +12 -5
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af3c8bb2d4eb2d7322c8a9a98ae15ea6e48ba627
4
- data.tar.gz: 09581799f0f12ab56fd190856197acb376420bdc
3
+ metadata.gz: 5cb56c09c20fadfd3f71c5926ea6aec4a67afcb7
4
+ data.tar.gz: 990492ae4fb68696da57acbd6c4e373878da56cc
5
5
  SHA512:
6
- metadata.gz: 2b80bcc383b0dec5ecddf30e3d6b79e456fbdb5b0b92c682419ca9d918bd0f32d6569b50d3bccd85ee5490ff8391e309398fc9ba5e63d8171e5762d5b1c3d274
7
- data.tar.gz: 0cf567a18c1e39efef67193097d8c5053eef3b05216a33e0ef6b211a01cb157e44d13482ef2a6491f81e54cdc451222f79f3d31a729ab2ae449015111332aa2b
6
+ metadata.gz: 4a78efe92d103820f71c023c7a365fe86687a752d0c5c1f88ce245abb30733386fc0281eae7e4dbdd701668edf15efc5fcebfb15a561d3c90c7a6cf2299f757a
7
+ data.tar.gz: edb224eee0b5a299acd103c32d6b18566f9819750846aa71b9e19307b6772eaeb751eb7b8216a3217d0d78d182bf586b61859aaf1b9533daa740f4d4feb765b0
data/bin/vl CHANGED
@@ -10,7 +10,8 @@ $options = {
10
10
  :skip => 0,
11
11
  :comment => /^#/,
12
12
  :probe_lines => 100,
13
- :justify => 'l'
13
+ :justify => 'l',
14
+ :quote => "\x00"
14
15
  }
15
16
 
16
17
 
@@ -31,10 +32,10 @@ opts = OptionParser.new do |opts|
31
32
  'char or string to match the separator',
32
33
  ' default: "," (if csv, "\t")') do |s|
33
34
  begin
34
- $options[:separator] = s
35
+ options[:separator] = Regexp.new(s)
35
36
  rescue
36
37
  puts 'Warning: Problems encountered when processing the regex.'
37
- puts "Warning: Default value \"#{$options[:separator]}\" is used."
38
+ puts "Warning: Default value \"#{$options[:separator].source}\" is used."
38
39
  end
39
40
  end
40
41
 
@@ -79,6 +80,12 @@ opts = OptionParser.new do |opts|
79
80
  STDERR.puts "Warning: Default value \"#{$options[:comment].source}\" is used."
80
81
  end
81
82
  end
83
+
84
+ opts.on('-q', '--quote [QUOTE_CHAR]',
85
+ 'character of quote',
86
+ ' default: \x00') do |q|
87
+ $options[:quote] = q
88
+ end
82
89
  end
83
90
 
84
91
  opts.parse!
@@ -104,7 +111,7 @@ cached_lines = []
104
111
  ARGF.each_line.with_index.reduce 0 do |pnum, (line, lnum)|
105
112
  cached_lines.push(line)
106
113
  next pnum if lnum < $options[:skip] or line =~ $options[:comment]
107
- parsed_line = CSV.parse_line(line, {:col_sep=>$options[:separator]})
114
+ parsed_line = CSV.parse_line(line, {:col_sep=>$options[:separator], :quote_char=>$options[:quote]})
108
115
  # damn you, 'csv' package!
109
116
  parsed_line = [] if parsed_line == nil
110
117
  parsed_line.each_with_index do |c, i|
@@ -123,7 +130,7 @@ def print_line(line, lnum)
123
130
  print line
124
131
  return
125
132
  end
126
- parsed_line = CSV.parse_line(line, {:col_sep=>$options[:separator]})
133
+ parsed_line = CSV.parse_line(line, {:col_sep=>$options[:separator], :quote_char=>$options[:quote]})
127
134
  # damn you, 'csv' package!
128
135
  parsed_line = [] if parsed_line == nil
129
136
  parsed_line.each_with_index do |c, i|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - xzhu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-04-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Nicely format columns of a large CSV/TSV file according to their content
14
14
  width, using first few lines as estimation thus extremely fast. Customizable.
@@ -42,8 +42,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.4.5
45
+ rubygems_version: 2.4.2
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: "(V)iew (L)arge table. Format large table in a split of a second"
49
49
  test_files: []
50
+ has_rdoc: