fixx 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/fixx +11 -11
  3. data/lib/fixx/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2411d8f5f90daac163d97769cf5cecc240cef14d
4
- data.tar.gz: cfe54f11d4668039494e6d3f21e85d13103deb50
3
+ metadata.gz: d8e0899db70b41f4b44b2d69686364bd5f468e82
4
+ data.tar.gz: 8589abda9b4dc53b9cacabe6070ea7e94a71fa38
5
5
  SHA512:
6
- metadata.gz: 1026f26650913c2e5416d9d9dc827005e9e3190a1d84931847ba0c023289b2d35accab8621eaa318d419d9ab163c64161a123f34495fa5419a4e5bad034c1f22
7
- data.tar.gz: 2c4d01a96a193ac0d37287e4ecc9c5027c105752ad957ff2a4c249672d032d5cdb650b3414e2233072d6d894ba91b6bfb64cf8424e88e4bff1a0a40d8a4c0b54
6
+ metadata.gz: b38567d5c80eae6270a11ab652694827e9cb8cce0aeda4f62658cd00e05c40fe0fbe408215072d3714bd0b1e8909a6a8696203b99ba161a2e2546685e1cdc8d4
7
+ data.tar.gz: 34dfa3a1b9334b8242ab509c1051d31d8090873072e3022d297727164c322d66d39845ccec20c7c4f4957a4ebd9056a7467d3d2c45f634ce40c2600e082d9e07
data/bin/fixx CHANGED
@@ -4,9 +4,9 @@ require 'optparse'
4
4
 
5
5
  fix_delim = "^A"
6
6
  human_delim = " : "
7
- extract_field = -1
7
+ extract_fields = "all"
8
8
  heartbeats = false
9
- message_type = "all"
9
+ message_types = "all"
10
10
  contains_field = "all"
11
11
  output_raw = false
12
12
 
@@ -27,16 +27,16 @@ OptionParser.new do |options|
27
27
  output_raw = flag
28
28
  end
29
29
 
30
- options.on("-m", "--message-type TYPE", String, "Filter for a specific message type.") do |value|
31
- message_type = value
30
+ options.on("-m", "--message-types t1,t2,t3", String, "Filter for specific message types (comma delimited list).") do |value|
31
+ message_types = value.split(",").map(&:strip)
32
32
  end
33
33
 
34
34
  options.on("-c", "--contains-field NUM", Integer, "Filter for messages that contain a particular field.") do |value|
35
35
  contains_field = value
36
36
  end
37
37
 
38
- options.on("-e", "--extract-field NUM", Integer, "Extract a particular field.") do |value|
39
- extract_field = value.to_i
38
+ options.on("-e", "--extract-fields f1,f2,f3", String, "Extract specific fields (comma delimited list).") do |value|
39
+ extract_fields = value.split(",").map{|x| x.strip.to_i}
40
40
  end
41
41
 
42
42
  options.on_tail("-h", "--help", "You're looking at it!") do
@@ -53,16 +53,16 @@ while input = ARGF.gets
53
53
 
54
54
  skip = false
55
55
  skip = true if !heartbeats && printable.include?(" 35=0 ")
56
- skip = true if message_type != "all" && !printable.include?(" 35=#{message_type} ")
56
+ skip = true unless message_types == "all" || message_types.any?{|mt| printable.include?(" 35=#{mt} ")}
57
57
  skip = true if contains_field != "all" && !printable.include?(" #{contains_field}=")
58
58
 
59
59
  unless skip
60
- if extract_field > 0
61
- match = printable.match(/#{extract_field.to_s}=[^ ]*/)
62
- if match.nil?
60
+ if extract_fields != "all"
61
+ matches = extract_fields.collect{|ef| printable.match(/#{ef.to_s}=[^ ]*/)}.select{|m| !m.nil?}
62
+ if matches.empty?
63
63
  skip = true
64
64
  else
65
- output_line = match[0]
65
+ output_line = matches.collect{|m| m[0]}.join(human_delim)
66
66
  end
67
67
  else
68
68
  output_line = printable
data/lib/fixx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fixx
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corbin Fox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler