ix-cli 0.0.18 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ix-extensions +8 -2
- data/bin/ix-file-exists +1 -1
- data/bin/ix-files +1 -1
- data/bin/ix-json-filter +21 -4
- data/bin/ix-json-template +1 -1
- data/bin/ix-slider +1 -1
- data/bin/ix-stack +1 -1
- data/bin/ix-stack-2 +1 -1
- data/bin/ix-template +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3db8ee07cb2484805653a3cabccc1f4d6a63859a5bc3783fc295e8e4d4582276
|
4
|
+
data.tar.gz: 3a0bf595a3177363edf3b6439158db59515b9697b5c118646207e090b356355d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52067dcdbc79ead6819d26e4c35bf6dbc625ffbd6c5e1d0f6177799d214b9a8ad5742a1b0f2b3102d628090a3c8ee492da82f84ad7b5612b7dc3c0d9e7506062
|
7
|
+
data.tar.gz: 7f9eb41d5c9e2d552a5c7e8bb775d91cd6e08709b642180f3bb836e5687dfd474fe4a1c4b441f09ed533daaaa72ea46c1c2de7237e1c483e94433b717f8c5363
|
data/bin/ix-extensions
CHANGED
data/bin/ix-file-exists
CHANGED
data/bin/ix-files
CHANGED
data/bin/ix-json-filter
CHANGED
@@ -10,17 +10,22 @@ OptionParser.new do |opts|
|
|
10
10
|
|
11
11
|
opts.banner = "Usage: #{$0} [OPTIONS]"
|
12
12
|
|
13
|
-
opts.on('-f', '--field [
|
13
|
+
opts.on('-f', '--field [STRING]', 'Field.') do |value|
|
14
14
|
options[:field] = value
|
15
15
|
end
|
16
16
|
|
17
|
+
opts.on('-v', '--value [STRING]', 'Field.') do |value|
|
18
|
+
options[:field] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
|
17
22
|
opts.on('-m', '--match [REGEX]', 'Match.') do |value|
|
18
23
|
options[:match] = value
|
19
24
|
end
|
20
25
|
|
21
26
|
end.parse!
|
22
27
|
|
23
|
-
required_options = [:
|
28
|
+
required_options = [:match]
|
24
29
|
required_options.each do |option|
|
25
30
|
unless options[option]
|
26
31
|
$stderr.puts "Can not run #{option.to_s} was not given."
|
@@ -28,11 +33,23 @@ required_options.each do |option|
|
|
28
33
|
end
|
29
34
|
end
|
30
35
|
|
36
|
+
if options[:field].nil? && options[:value].nil?
|
37
|
+
$stderr.puts "Can not run without field or value."
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
|
31
41
|
STDIN.each_line do |line|
|
32
42
|
begin
|
33
43
|
json = JSON.parse(line)
|
34
|
-
if
|
35
|
-
|
44
|
+
if options[:field]
|
45
|
+
if json[options[:field]].to_s =~ /#{options[:match]}/
|
46
|
+
puts line
|
47
|
+
end
|
48
|
+
end
|
49
|
+
if options[:value]
|
50
|
+
if json.values.any? { |v| v.to_s =~ /#{options[:match]}/ }
|
51
|
+
puts line
|
52
|
+
end
|
36
53
|
end
|
37
54
|
rescue JSON::ParserError => e
|
38
55
|
$stderr.puts "Error parsing line: #{line}"
|
data/bin/ix-json-template
CHANGED
data/bin/ix-slider
CHANGED
data/bin/ix-stack
CHANGED
data/bin/ix-stack-2
CHANGED
data/bin/ix-template
CHANGED