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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c092a50cdc78203f0d6b63eaf7ab134ef75c6fcd2359433f30ccc75a1927fa4
4
- data.tar.gz: b56649886c4163ce425c95fdf178db6255983b0bd093af8dc8f7b92e5a1734a8
3
+ metadata.gz: 3db8ee07cb2484805653a3cabccc1f4d6a63859a5bc3783fc295e8e4d4582276
4
+ data.tar.gz: 3a0bf595a3177363edf3b6439158db59515b9697b5c118646207e090b356355d
5
5
  SHA512:
6
- metadata.gz: ffff3b4215e024457a8271bd2c670a50df67309b5753fa91d6940c917b7e2e91c0c7803b92d568dcb79a9cabee6699a6a1f54901ab6a9a3ead4d1ed7fe1f1375
7
- data.tar.gz: 2f291e87dd401b6b11c3601ff11e05d403cb10bc2452fb773cd063c3789a3ceb8c90ce2af04585f25de376d8e52759f126104567efd71ca5725cd4fe93b9ea5d
6
+ metadata.gz: 52067dcdbc79ead6819d26e4c35bf6dbc625ffbd6c5e1d0f6177799d214b9a8ad5742a1b0f2b3102d628090a3c8ee492da82f84ad7b5612b7dc3c0d9e7506062
7
+ data.tar.gz: 7f9eb41d5c9e2d552a5c7e8bb775d91cd6e08709b642180f3bb836e5687dfd474fe4a1c4b441f09ed533daaaa72ea46c1c2de7237e1c483e94433b717f8c5363
data/bin/ix-extensions CHANGED
@@ -1,3 +1,9 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env ruby
2
2
 
3
- ix scan '\.\w+$' | sed 's/\.//g'
3
+ require 'json'
4
+
5
+ STDIN.each_line do |line|
6
+ line.chomp!
7
+ result = { :ext => File.extname(line), :path => line }
8
+ puts result.to_json
9
+ end
data/bin/ix-file-exists CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  STDIN.each_line do |line|
4
4
 
5
- if File.exists?(line.chomp)
5
+ if File.exist?(line.chomp)
6
6
  puts "yes #{line.chomp}"
7
7
  else
8
8
  puts " no #{line.chomp}"
data/bin/ix-files CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  STDIN.each_line do |line|
4
4
  fname = line.chomp
5
- if File.exists?(fname)
5
+ if File.exist?(fname)
6
6
  puts fname
7
7
  end
8
8
  end
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 [NAME]', 'Field.') do |value|
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 = [:field, :match]
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 json[options[:field]].to_s =~ /#{options[:match]}/
35
- puts line
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
@@ -240,7 +240,7 @@ require 'digest/md5'
240
240
  source = ARGV[0]
241
241
  target = ARGV[1]
242
242
 
243
- unless File.exists?(source)
243
+ unless File.exist?(source)
244
244
  $stderr.puts "File not found: #{source}"
245
245
  exit 0
246
246
  end
data/bin/ix-slider CHANGED
@@ -149,7 +149,7 @@ end
149
149
  $stdout.sync = true
150
150
  puts legend
151
151
 
152
- if File.exists?($options[:file])
152
+ if File.exist?($options[:file])
153
153
  $options[:current_value] = File.read($options[:file]).to_i
154
154
  end
155
155
 
data/bin/ix-stack CHANGED
@@ -10,7 +10,7 @@ STDIN.each do |line|
10
10
  line_number = chunks[1].to_i
11
11
  spacer = file.scan(/^\s*/)[0]
12
12
  file.gsub!(/^\s+/, '')
13
- unless File.exists? file
13
+ unless File.exist? file
14
14
  puts line
15
15
  next
16
16
  end
data/bin/ix-stack-2 CHANGED
@@ -14,7 +14,7 @@ STDIN.each_line do |stack_line|
14
14
  range_right = (line..(line + 5)).to_a
15
15
  full_range = (range_left + range_right).sort
16
16
 
17
- if File.exists?(filepath)
17
+ if File.exist?(filepath)
18
18
  file_line = 0
19
19
  File.read(filepath).each_line do |fline|
20
20
  file_line += 1
data/bin/ix-template CHANGED
@@ -17,7 +17,7 @@ end
17
17
 
18
18
  if ARGV[0]
19
19
  template = "#{ARGV[0]}"
20
- if File.exists?(template)
20
+ if File.exist?(template)
21
21
  template = File.read(template)
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ix-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuyoshi Tlacaelel