fix_protocol_tools 1.0.0 → 1.0.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.
data/bin/fixgrep
CHANGED
|
@@ -51,22 +51,28 @@ module FixProtocolTools
|
|
|
51
51
|
return unless fields
|
|
52
52
|
|
|
53
53
|
@spec ||= resolve_specification(fields)
|
|
54
|
-
|
|
54
|
+
rows = []
|
|
55
|
+
rows << yellow(' =-=-=-=-=-=-==-=-=-=-=-=-==-=-=-=-=-=-= ')
|
|
56
|
+
is_found = @grep.nil?
|
|
55
57
|
|
|
56
58
|
fields.each do |field_id, value_id|
|
|
57
59
|
field_name = @spec.field_name(field_id) || field_id
|
|
58
60
|
field_name_padding = @spec.max_field_length - field_name.length - 2
|
|
61
|
+
value_name = if @spec.message_type?(field_id)
|
|
62
|
+
red(@spec.message_type(value_id))
|
|
63
|
+
else
|
|
64
|
+
@spec.enum_value(field_id, value_id)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if @grep && (value_name.include?(@grep) || value_id.include?(@grep))
|
|
68
|
+
value_name = red(value_name)
|
|
69
|
+
is_found = true
|
|
70
|
+
end
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
rows << formatted_row(field_id, value_id, field_name, value_name, field_name_padding)
|
|
61
73
|
end
|
|
62
|
-
end
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
if @spec.message_type?(field_id)
|
|
66
|
-
formatted_row(field_id, value_id, field_name, red(@spec.message_type(value_id)), padding)
|
|
67
|
-
else
|
|
68
|
-
formatted_row(field_id, value_id, field_name, @spec.enum_value(field_id, value_id), padding)
|
|
69
|
-
end
|
|
75
|
+
rows.each { |row| @output.puts row } if is_found
|
|
70
76
|
end
|
|
71
77
|
|
|
72
78
|
def formatted_row(field_id, value_id, field_name, value_name, field_name_padding)
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
require 'term/ansicolor'
|
|
2
2
|
require 'fix_protocol_tools/messages_processor'
|
|
3
3
|
|
|
4
|
-
Term::ANSIColor::coloring = STDOUT.isatty
|
|
5
4
|
|
|
6
5
|
module FixProtocolTools
|
|
7
6
|
class Runner
|
|
7
|
+
@coloring = Term::ANSIColor::coloring = STDOUT.isatty
|
|
8
|
+
|
|
8
9
|
|
|
9
10
|
def less!
|
|
10
|
-
options = {:less => false, :color =>
|
|
11
|
+
options = {:less => false, :color => @coloring}
|
|
11
12
|
opt_parse = OptionParser.new do |opts|
|
|
12
13
|
opts.banner = "Usage: fixless [options] [fixlogfile]"
|
|
13
14
|
|
|
14
|
-
color(options, opts)
|
|
15
|
-
help(opts)
|
|
16
|
-
|
|
17
15
|
opts.on('-l', '--[no-]less', 'Use less command for output') do |color|
|
|
18
16
|
options[:less] = color
|
|
19
17
|
end
|
|
18
|
+
|
|
19
|
+
color(options, opts)
|
|
20
|
+
help(opts)
|
|
21
|
+
dictionary(options, opts)
|
|
20
22
|
end
|
|
21
23
|
|
|
22
24
|
opt_parse.parse!
|
|
@@ -25,11 +27,16 @@ module FixProtocolTools
|
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def grep!
|
|
28
|
-
options = {:color =>
|
|
30
|
+
options = {:color => @coloring}
|
|
29
31
|
opt_parse = OptionParser.new do |opts|
|
|
30
|
-
opts.banner = "Usage: fixgrep [options] [fixlogfile]"
|
|
32
|
+
opts.banner = "Usage: fixgrep -v value [options] [fixlogfile]"
|
|
33
|
+
|
|
34
|
+
opts.on('-v', '--v value') do |pattern|
|
|
35
|
+
options[:grep] = pattern
|
|
36
|
+
end
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
dictionary(options, opts)
|
|
39
|
+
color(options, opts)
|
|
33
40
|
help(opts)
|
|
34
41
|
end
|
|
35
42
|
|
|
@@ -52,5 +59,11 @@ module FixProtocolTools
|
|
|
52
59
|
options[:color] = color
|
|
53
60
|
end
|
|
54
61
|
end
|
|
62
|
+
|
|
63
|
+
def dictionary(options, opts)
|
|
64
|
+
#opts.on('-d', '--dictionary PATH_TO_DICTIONARY') do |dictionary|
|
|
65
|
+
# options[:dictionary] = dictionary
|
|
66
|
+
#end
|
|
67
|
+
end
|
|
55
68
|
end
|
|
56
69
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fix_protocol_tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-05-
|
|
12
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: term-ansicolor
|
|
@@ -81,7 +81,7 @@ files:
|
|
|
81
81
|
- lib/fix_protocol_tools/specification/xml/FIX43.xml
|
|
82
82
|
- lib/fix_protocol_tools/specification/xml/FIX44.xml
|
|
83
83
|
- lib/fix_protocol_tools/version.rb
|
|
84
|
-
homepage:
|
|
84
|
+
homepage: https://github.com/Luxor/fix-protocol-tools
|
|
85
85
|
licenses:
|
|
86
86
|
- MIT
|
|
87
87
|
post_install_message:
|