honey_format 0.15.0 → 0.16.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 857b7d39a88dc2a08a7fe2e3659e4e35e0b5deec1d13b3507ec74849ed55a105
4
- data.tar.gz: cc1bd4d205e225a9767d96cd7f49d89374b55c6221de42f28210666bb505193c
3
+ metadata.gz: e9afe55f28e5bdd981ecf3a73fc49c52a145442c8ebf3e0c5da2e18c4d43eea6
4
+ data.tar.gz: 3943032cb540bb1ce70b2cb21e99e5288d42ba06b261e08e125c0f9d895c67ae
5
5
  SHA512:
6
- metadata.gz: 13e3ac4d6e10d6e416b21ef909e42960a9aa33b5d09fbb231f5703390d9b9440e2271fb3bc7842a8d233ec89652051de44c4bc7c542a06fd78853d8185ed5104
7
- data.tar.gz: 66b176f2f89999eb80c4e2688fde3db94c92dc7a3d25f2520f838dfbbc38f61c8711ee0f266d282d5930a4eb65ba8cebcb44bc81b1cbd0fc6381515487f62e98
6
+ metadata.gz: 1476f913fa1eabc823295cc327b13ba188fb5be82e76e72e6b3d60f8d80bbda098cb4170a2d7e081026dcf9a5fdfd0f9ce0d632e5d37f064ae744c8f5ebacd34
7
+ data.tar.gz: e957fbd91dd47ca60bd4581b754c6667992cdc96ac79c6f66171f90d9647db6f08387c6e6cedf0681efc5b18535fc37eb75fcb0039b3fd4fa0a6973337c49c71
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # HEAD
2
2
 
3
+ ## v0.16.0
4
+
5
+ * Add `--type-map` option to CLI
6
+
3
7
  ## v0.15.0
4
8
 
5
9
  :warning: This release contains some backwards compatible changes.
data/exe/honey_format CHANGED
@@ -14,6 +14,7 @@ csv_input = File.read(input_path)
14
14
  csv = HoneyFormat::CSV.new(
15
15
  csv_input,
16
16
  delimiter: options[:delimiter],
17
+ type_map: options[:type_map],
17
18
  skip_lines: options[:skip_lines]
18
19
  )
19
20
 
@@ -30,6 +30,7 @@ module HoneyFormat
30
30
  header_only = false
31
31
  rows_only = false
32
32
  skip_lines = nil
33
+ type_map = {}
33
34
 
34
35
  OptionParser.new do |parser|
35
36
  parser.banner = "Usage: honey_format [options] <file.csv>"
@@ -55,6 +56,10 @@ module HoneyFormat
55
56
  skip_lines = value
56
57
  end
57
58
 
59
+ parser.on('--type-map=[key1=val1,key2=val2]', Array, 'Type map') do |value|
60
+ type_map = option_to_h(value || [])
61
+ end
62
+
58
63
  parser.on("--[no-]header-only", "Print only the header") do |value|
59
64
  header_only = value
60
65
  end
@@ -90,8 +95,13 @@ module HoneyFormat
90
95
  delimiter: delimiter,
91
96
  header_only: header_only,
92
97
  rows_only: rows_only,
93
- skip_lines: skip_lines
98
+ skip_lines: skip_lines,
99
+ type_map: type_map
94
100
  }
95
101
  end
102
+
103
+ def option_to_h(option)
104
+ option.map { |v| v.split('=').map(&:to_sym) }.to_h
105
+ end
96
106
  end
97
107
  end
@@ -2,7 +2,7 @@ module HoneyFormat
2
2
  # Gem version
3
3
  VERSION = [
4
4
  MAJOR_VERSION = 0,
5
- MINOR_VERSION = 15,
5
+ MINOR_VERSION = 16,
6
6
  PATCH_VERSION = 0
7
7
  ].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honey_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Burenstam