dorian-csv-all 0.0.1 → 0.1.1
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 +4 -4
- data/bin/csv-all +7 -21
- metadata +5 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef1458b07f41c58a295726570be10b8dcccf88779653569ee16b9b242c18646c
|
4
|
+
data.tar.gz: f3094386a766e63650bcda425512ca80048c8967f6ab56763dd96e0284c60d7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ccf397bc5033ae812fc8c1aece80a8fb98f9f77e2a9fbba38c5dd7d4992dfc904b575a45f8b683dcb5bab7afd570ae6681e90f371f986d7a29de2e782080c96
|
7
|
+
data.tar.gz: c5299e2f25b22460a7e88f5002b6cc0417d17609a194b63e5a7c2e55e65e7db238768d3f262b43128833d98b717f5c2cdf954a32811c45b270f04b5921396c71
|
data/bin/csv-all
CHANGED
@@ -2,27 +2,13 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "csv"
|
5
|
-
require "
|
6
|
-
require "active_support"
|
7
|
-
require "active_support/core_ext/hash/indifferent_access"
|
5
|
+
require "dorian-to_struct"
|
8
6
|
|
9
|
-
|
7
|
+
HEADERS = ARGV.detect { |argv| argv == "-h" || argv == "--headers" }
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
.
|
14
|
-
|
9
|
+
it =
|
10
|
+
CSV
|
11
|
+
.parse($stdin.each_line.to_a.map(&:strip).join("\n"), headers: !!HEADERS)
|
12
|
+
.map { |line| HEADERS ? line.to_h.to_struct : line.to_a }
|
15
13
|
|
16
|
-
|
17
|
-
options[:headers] = true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
.parse!
|
21
|
-
|
22
|
-
abort "See --help" if argv.size != 1
|
23
|
-
|
24
|
-
it = CSV.parse($stdin.each_line.to_a.join, headers: options[:headers]).map do |line|
|
25
|
-
options[:headers] ? line.to_h.with_indifferent_access : line.to_a
|
26
|
-
end
|
27
|
-
|
28
|
-
eval(argv.first)
|
14
|
+
eval((ARGV - [HEADERS]).join(" "))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-csv-all
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: csv
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: dorian-to_struct
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -38,10 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
42
|
-
Evaluates some code all lines of the csv input
|
43
|
-
|
44
|
-
e.g. `cat users.csv | csv-all --headers "puts it.first[:name]"`
|
41
|
+
description: evaluates some ruby code on all lines of the csv input
|
45
42
|
email: dorian@dorianmarie.com
|
46
43
|
executables:
|
47
44
|
- csv-all
|
@@ -72,5 +69,5 @@ requirements: []
|
|
72
69
|
rubygems_version: 3.5.11
|
73
70
|
signing_key:
|
74
71
|
specification_version: 4
|
75
|
-
summary:
|
72
|
+
summary: evaluates some ruby code on all lines of the csv input
|
76
73
|
test_files: []
|