idata 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/icsvutils +19 -13
  3. data/lib/idata/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be645ca0daedeec45060ae7434adbf7d3c63a3f9
4
- data.tar.gz: 8558bb7c6773bcec21ec21f0fc16581a82000774
3
+ metadata.gz: ef49d322db71fc0f179ff0d2ca1412998821694c
4
+ data.tar.gz: 8b10462121074019fc66ed5e38587bf4515aa27c
5
5
  SHA512:
6
- metadata.gz: e3ba4939323b57b1c6b6183879f07a9c8643ec7a671b2a7d3e5c84c6a826ac42a9e497b6722406722c9d794f1628f09b18ce1b73993b7174555a0eb944fa20fb
7
- data.tar.gz: c506d99a5159751d6ef1664168222a18f152861bca68e7c9cafb01f183a8ea4026c8db976ac530fc0306205b7f042fc2fc26e7da85af1b95bb1785a88d7d516d
6
+ metadata.gz: a2de21d257026f1bfda26dc4d552c64a946f4363438227af9383d9ea2a4d05cbd582731f4f14e30faa8aec885f65248779a198632038f02d9870ac9e13ff8894
7
+ data.tar.gz: bfd0ba660ec70ca98e032c94afd364876c4f9be799360feea8e2e312f6a2e77cbed15024450ac485220183639fa521cc1354391b6e68c6bcce18e96895659879
@@ -29,29 +29,37 @@ def error(msg)
29
29
  end
30
30
 
31
31
  $options = {:actions => {}}
32
- parser = OptionParser.new("", 24) do |opts|
33
- opts.banner = "Program: icsvutils #{1}\nAuthor: Gaugau\n\nUsage: iscvutils file [options]\n"
32
+ parser = OptionParser.new("", 30) do |opts|
33
+ opts.banner = "Program: icsvutils #{Idata::VERSION}\nAuthor: Gaugau\nUsage: iscvutils file [options]\n"
34
34
  opts.version = 1
35
-
36
- opts.separator ""
37
- opts.separator "Command options:"
38
35
 
39
36
  opts.on("--set-delim DELIMITER", "Set file delimiter") do |v|
40
37
  $options[:actions][:set_delim] = v
41
38
  end
42
39
 
43
- opts.on("--set-encoding DELIMITER", "Set file encoding. Valid values include: UTF8, UTF16, ASCII, ISO, etc.") do |v|
40
+ opts.on("--set-encoding ENCODING", "Set file encoding. Valid values include: UTF8, UTF16, ISO, etc.") do |v|
44
41
  $options[:actions][:set_encoding] = v
45
42
  end
46
-
47
- opts.separator ""
48
- opts.separator "Common options:"
49
43
 
50
44
  opts.on_tail('--help', 'Displays this help') do
51
45
  puts opts, "", help
52
46
  exit
53
47
  end
54
-
48
+ end
49
+
50
+ def help
51
+ return <<-eos
52
+ Example:
53
+ -------------------------------------------------------
54
+ Convert a tabular file to a tab-separated one.\nNote that the original file format will be auto detected
55
+
56
+ icsvutils /path/to/file --set-delim=$'\\t'
57
+
58
+ Convert a tabular file to a CSV (comma-delimited) one
59
+
60
+ icsvutils /path/to/file --set-delim=","
61
+
62
+ eos
55
63
  end
56
64
 
57
65
  parser.parse!
@@ -83,8 +91,6 @@ $options[:quote] ||= CSV_DEFAULT_QUOTE
83
91
  $options[:table] ||= 'items'
84
92
  $options[:actions][:set_delim] ||= CSV_DEFAULT_DELIMITER
85
93
 
86
- p $options
87
-
88
94
  $tmpfile = "/tmp/#{Digest::SHA1.hexdigest(rand(100000).to_s)}.csv"
89
95
 
90
96
  class String
@@ -189,7 +195,7 @@ class MyParser
189
195
 
190
196
  create_table_sql = headers.map{|e| "\"#{e}\" text"}.join(",")
191
197
  create_table_sql = "create table #{$options[:table]}( #{create_table_sql} );"
192
- puts create_table_sql
198
+
193
199
  importcmd = %Q{
194
200
  sqlite3 /tmp/i <<!
195
201
  #{create_table_sql}
@@ -1,3 +1,3 @@
1
1
  module Idata
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nghi Pham