hilight 0.2.0 → 0.3.0
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/Gemfile.lock +1 -5
- data/README.md +0 -89
- data/bin/add_theme +0 -0
- data/bin/convert_vscode +70 -0
- data/bin/generate_theme +0 -0
- data/exe/hilight +15 -25
- data/hilight.gemspec +0 -2
- data/lib/hilight.rb +54 -42
- data/lib/hilight/fabric.rb +28 -0
- data/lib/hilight/pair.rb +3 -0
- data/lib/hilight/pattern.rb +15 -0
- data/lib/hilight/quilt.rb +40 -0
- data/lib/hilight/quilts.rb +2 -0
- data/lib/hilight/quilts/default.rb +17 -0
- data/lib/hilight/quilts/help.rb +17 -0
- data/lib/hilight/quilts/rspec.rb +23 -0
- data/lib/hilight/quilts/ruby.rb +14 -0
- data/lib/hilight/version.rb +1 -1
- metadata +14 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efb96144dc97389952d9826395882b4a1dd5d68d9e552ec4bf8e1e818a996ce0
|
4
|
+
data.tar.gz: e35ecc2c389873b224a1e22ba5e603dafd54d79cab186b91e03d6560ceacb970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d34ec3fcbf06c6eee8525b9ed51066f9c057bb4c9574d0d4c8d574e2c56a4cebff69d8f5ae5df341982b72bd04e68ed2dcccc5f54c1bf33dee0c4b96a33d70ab
|
7
|
+
data.tar.gz: 25306cc41aff58fac69477acb38596940f129081035629bf736a64c74d939266a0eb34325d90143e6ad6a6be74c3792799bf85c1dc02ce07847efe5b4559cc71
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hilight (0.
|
5
|
-
term-ansicolor
|
4
|
+
hilight (0.3.0)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
@@ -126,11 +125,8 @@ GEM
|
|
126
125
|
thor (~> 0.19, >= 0.19.4)
|
127
126
|
tilt (~> 2.0)
|
128
127
|
yard (~> 0.9)
|
129
|
-
term-ansicolor (1.7.1)
|
130
|
-
tins (~> 1.0)
|
131
128
|
thor (0.20.3)
|
132
129
|
tilt (2.0.9)
|
133
|
-
tins (1.20.2)
|
134
130
|
unicode-display_width (1.4.1)
|
135
131
|
yard (0.9.18)
|
136
132
|
|
data/README.md
CHANGED
@@ -37,92 +37,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/ernieb
|
|
37
37
|
## Code of Conduct
|
38
38
|
|
39
39
|
Everyone interacting in the Hilight project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/erniebrodeur/hilight/blob/master/CODE_OF_CONDUCT.md).
|
40
|
-
|
41
|
-
["patterns"].map { |m| Match.new m["regexp"],m["sub_string"] }
|
42
|
-
|
43
|
-
``` yaml
|
44
|
-
:cmd: rspec
|
45
|
-
:patterns:
|
46
|
-
- :regexp: (?<green>\\d+) examples, (?<red>\\d+) failures, (?<yellow>\\d+) pending
|
47
|
-
:sub_string: \\k<green> examples, \\k<red> failures, \\k<yellow> pending
|
48
|
-
- :regexp: (?<blue>\\d+\\.\\d+)
|
49
|
-
:sub_string: \\k<blue>
|
50
|
-
- :regexp: (?<green>.*?)\"|\'(?<green>.*?)\'
|
51
|
-
:sub_string: \\k<green>
|
52
|
-
- :regexp: "# (?<red>.*):(?<yellow>\d+)"
|
53
|
-
:sub_string: \\k<red>:\\k<yellow>
|
54
|
-
```
|
55
|
-
|
56
|
-
``` ruby
|
57
|
-
{
|
58
|
-
"cmd" => "rspec",
|
59
|
-
"patterns" =>[
|
60
|
-
{
|
61
|
-
"regexp" => %r{(?<green>\d+) examples, (?<red>\d+) failures, (?<yellow>\d+) pending},
|
62
|
-
"sub_string" =>'\k<green> examples, \k<red> failures, \k<yellow> pending'
|
63
|
-
},
|
64
|
-
{
|
65
|
-
"regexp" => %r{(?<blue>\d+\.\d+)},
|
66
|
-
"sub_string" =>'\k<blue>'
|
67
|
-
},
|
68
|
-
{
|
69
|
-
"regexp" => %r{"(?<green>.*?)"|'(?<green>.*?)'},
|
70
|
-
"sub_string" =>'\k<green>'
|
71
|
-
},
|
72
|
-
{
|
73
|
-
"regexp" => %r{# (?<red>.*):(?<yellow>\d+)},
|
74
|
-
"sub_string" =>'\k<red>:\k<yellow>'
|
75
|
-
}
|
76
|
-
]
|
77
|
-
}
|
78
|
-
```
|
79
|
-
|
80
|
-
|
81
|
-
``` json
|
82
|
-
{
|
83
|
-
":cmd":"rspec",
|
84
|
-
":patterns":[
|
85
|
-
{
|
86
|
-
":regexp":"(?<green>\\d+) examples, (?<red>\\d+) failures, (?<yellow>\\d+) pending",
|
87
|
-
":sub_string":"\\k<green> examples, \\k<red> failures, \\k<yellow> pending"
|
88
|
-
},
|
89
|
-
{
|
90
|
-
":regexp":"(?<blue>\\d+\\.\\d+)",
|
91
|
-
":sub_string":"\\k<blue>"
|
92
|
-
},
|
93
|
-
{
|
94
|
-
":regexp":"(?<green>.*?)\\\"|'(?<green>.*?)'",
|
95
|
-
":sub_string":"\\k<green>"
|
96
|
-
},
|
97
|
-
{
|
98
|
-
":regexp":"\\# (?<red>.*):(?<yellow>\\d+)",
|
99
|
-
":sub_string":"\\k<red>:\\k<yellow>"
|
100
|
-
}
|
101
|
-
]
|
102
|
-
}```
|
103
|
-
|
104
|
-
|
105
|
-
(pick our input from cmd matching)
|
106
|
-
->(input)->(select our pattern[])->(stringify input)
|
107
|
-
->(add colors)->(stringify output)
|
108
|
-
|
109
|
-
|
110
|
-
### Pattern selection / cmdline matching
|
111
|
-
filter => Struct[:filter_regexp, :selected_patterns]
|
112
|
-
.find(input_string) (patterns)
|
113
|
-
|
114
|
-
|
115
|
-
### String IO Arch
|
116
|
-
pattern => Struct[:regexp, :replacement_pattern]
|
117
|
-
.transform(input_string) (String)
|
118
|
-
.transform_stream(IO) (IO)
|
119
|
-
.match?(input_string) (Boolean)
|
120
|
-
|
121
|
-
patterns => pattern[]
|
122
|
-
.transform(input_string, stop_on_first: false) (String)
|
123
|
-
.transform_stream(IO) (IO)
|
124
|
-
|
125
|
-
# major things to do
|
126
|
-
# remove need for termansi by wiring up my own color lambda's
|
127
|
-
# wire up themes via lamdas
|
128
|
-
# wire up loading (selective or otherwise) of a set of default hilight's
|
data/bin/add_theme
ADDED
File without changes
|
data/bin/convert_vscode
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/env/bin ruby
|
2
|
+
require 'pry'
|
3
|
+
require 'oj'
|
4
|
+
|
5
|
+
c = File.read ARGV[0]
|
6
|
+
h = Oj.load c
|
7
|
+
colors = h['tokenColors']
|
8
|
+
colors.map { |e| [e['name'], e['settings']['foreground']] }.to_h
|
9
|
+
monokai_hex_colors = colors.map { |e| [e['name'], e['settings']['foreground']] }.to_h
|
10
|
+
monokai_hex_colors.delete_if { |k, v| k.nil? || v.nil? }
|
11
|
+
|
12
|
+
String.define_method(:to_rgb) { [self[1..2], self[2..3], self[4..5]].map { |s| s.to_i(16) }.join(";") }
|
13
|
+
output = monokai_hex_colors.map { |k,v| [k,v.to_rgb] }.to_h
|
14
|
+
|
15
|
+
puts Oj.dump output, indent: 2
|
16
|
+
|
17
|
+
# Monokai colors, for later.
|
18
|
+
{
|
19
|
+
"Comment" => "103;118;247",
|
20
|
+
"String" => "229;92;7",
|
21
|
+
"js template-expression" => "198;103;141",
|
22
|
+
"TemplateString" => "171;187;43",
|
23
|
+
"Number" => "198;103;141",
|
24
|
+
"Embeded String Begin and End" => "198;103;141",
|
25
|
+
"Embeded String" => "152;140;55",
|
26
|
+
"Built-in constant" => "86;107;108",
|
27
|
+
"User-defined constant" => "86;107;108",
|
28
|
+
"Language Variable" => "224;6;199",
|
29
|
+
"Variable" => "97;26;254",
|
30
|
+
"Keyword" => "224;6;199",
|
31
|
+
"Keyword Operator" => "224;6;199",
|
32
|
+
"Storage" => "224;6;199",
|
33
|
+
"Storage type" => "86;107;108",
|
34
|
+
"Class name" => "97;26;254",
|
35
|
+
"Variable Object" => "97;26;254",
|
36
|
+
"Other variable" => "171;187;43",
|
37
|
+
"Inherited class" => "152;140;55",
|
38
|
+
"Function name" => "152;140;55",
|
39
|
+
"Function argument" => "209;25;166",
|
40
|
+
"Function call" => "171;187;43",
|
41
|
+
"Builtin Functions" => "152;140;55",
|
42
|
+
"Tag name" => "224;6;199",
|
43
|
+
"Tag Class and ID" => "86;107;108",
|
44
|
+
"Tag attribute" => "152;140;55",
|
45
|
+
"Library constant" => "86;107;108",
|
46
|
+
"Library class/type" => "86;107;108",
|
47
|
+
"Json Property" => "86;107;108",
|
48
|
+
"StyleSheet Property name" => "171;187;43",
|
49
|
+
"StyleSheet Property value" => "152;140;55",
|
50
|
+
"StyleSheet Variable" => "86;107;108",
|
51
|
+
"StyleSheet Variable String" => "229;92;7",
|
52
|
+
"StyleSheet Unit" => "198;103;141",
|
53
|
+
"StyleSheet Function" => "86;107;108",
|
54
|
+
"Invalid" => "248;143;143",
|
55
|
+
"Invalid deprecated" => "248;143;143",
|
56
|
+
"JSON String" => "86;107;108",
|
57
|
+
"Link" => "97;26;254",
|
58
|
+
"diff.header" => "117;87;21",
|
59
|
+
"diff.deleted" => "198;103;141",
|
60
|
+
"diff.inserted" => "229;92;7",
|
61
|
+
"diff.changed" => "229;92;7",
|
62
|
+
"Markup: Emphasis Punctuation" => "105;150;150",
|
63
|
+
"Markdown: Link" => "97;26;254",
|
64
|
+
"Markdown: Bold Punctuation" => "105;150;150",
|
65
|
+
"Markdown: Heading" => "105;150;150",
|
66
|
+
"Markdown: Quote" => "152;140;55",
|
67
|
+
"Markdown: Separator" => "198;103;141",
|
68
|
+
"Markdown: Raw" => "86;107;108",
|
69
|
+
"Markdown: List Punctuation" => "255;255;255"
|
70
|
+
}
|
data/bin/generate_theme
ADDED
File without changes
|
data/exe/hilight
CHANGED
@@ -1,34 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require "hilight"
|
4
|
-
require 'term/ansicolor'
|
5
5
|
require 'open3'
|
6
6
|
require 'optparse'
|
7
7
|
|
8
8
|
include Hilight #rubocop:disable all
|
9
|
-
def split_opts(array)
|
10
|
-
cmd_start_index = array.find_index { |e| !e.start_with? "-" }
|
11
|
-
return [[], array] if !cmd_start_index || cmd_start_index.zero?
|
12
|
-
|
13
|
-
[array[0..cmd_start_index - 1], array[cmd_start_index..-1]]
|
14
|
-
end
|
15
|
-
|
16
|
-
rspec = Fabric['rspec', [
|
17
|
-
/(?<green>\d+) examples, (?<red>\d+) failures?, (?<yellow>\d+) pending/,
|
18
|
-
/(?<blue>\d+\.\d+)/,
|
19
|
-
/\"(?<green>.*?)\"|\'(?<green>.*?)\'/,
|
20
|
-
/# (?<red>.*):(?<yellow>\d+)/
|
21
|
-
]]
|
22
|
-
|
23
|
-
help = Fabric[/-h|--help|help/, /(?<yellow>\B-{1,2}[\w-]+)|(?<blue>[\[\]\(\)\{\}\<\>])|(?<green>["'].*?["'])/]
|
24
|
-
git = Fabric["git", /(?<green>'.*?')|(?<blue>".*?")/]
|
25
|
-
ruby = Fabric['ruby', /(.*from |)(?<red>.*):(?<blue>\d+)(?::in )(?<yellow>`.*')/]
|
26
|
-
default = Fabric['default', /(?<green>\d+\.\d+)|(?<blue>".*")/]
|
27
|
-
|
28
|
-
fabrics = [rspec, git, ruby, help, default]
|
29
9
|
|
10
|
+
### Parsing
|
30
11
|
options = {}
|
31
|
-
|
32
12
|
parser = OptionParser.new do |opts|
|
33
13
|
opts.banner = "Usage: hilight <cmd>"
|
34
14
|
|
@@ -37,17 +17,27 @@ parser = OptionParser.new do |opts|
|
|
37
17
|
end
|
38
18
|
end
|
39
19
|
|
20
|
+
def split_opts(array)
|
21
|
+
cmd_start_index = array.find_index { |e| !e.start_with? "-" }
|
22
|
+
return [[], array] if !cmd_start_index || cmd_start_index.zero?
|
23
|
+
|
24
|
+
[array[0..cmd_start_index - 1], array[cmd_start_index..-1]]
|
25
|
+
end
|
26
|
+
|
40
27
|
arguments, cmd = split_opts ARGV
|
41
28
|
parser.parse arguments
|
42
29
|
|
30
|
+
fabrics = Hilight::Quilts.constants.map { |c| Hilight::Quilts.const_get c }
|
31
|
+
|
32
|
+
### Execution
|
43
33
|
if cmd.any?
|
44
34
|
cmd_string = cmd.join(' ')
|
45
35
|
|
46
|
-
|
47
|
-
|
36
|
+
quilt = fabrics.find { |q| q.match? cmd_string }
|
37
|
+
quilt ||= default
|
48
38
|
|
49
39
|
output, process = Open3.capture2e(cmd_string)
|
50
|
-
print
|
40
|
+
print quilt.transform output
|
51
41
|
|
52
42
|
exit process.exitstatus
|
53
43
|
else
|
data/hilight.gemspec
CHANGED
data/lib/hilight.rb
CHANGED
@@ -1,58 +1,70 @@
|
|
1
|
-
require
|
2
|
-
require '
|
1
|
+
require 'hilight/fabric'
|
2
|
+
require 'hilight/pair'
|
3
|
+
require 'hilight/pattern'
|
4
|
+
require 'hilight/quilt'
|
5
|
+
require 'hilight/quilts'
|
6
|
+
require 'hilight/quilts/default'
|
7
|
+
require 'hilight/quilts/help'
|
8
|
+
require 'hilight/quilts/rspec'
|
9
|
+
require 'hilight/quilts/ruby'
|
10
|
+
require 'hilight/version'
|
11
|
+
|
12
|
+
module Hilight
|
13
|
+
module_function
|
14
|
+
|
15
|
+
define_method(:black) { |s| "\e[30m" + s.to_s + "\e[0m" }
|
16
|
+
define_method(:red) { |s| "\e[31m" + s.to_s + "\e[0m" }
|
17
|
+
define_method(:green) { |s| "\e[32m" + s.to_s + "\e[0m" }
|
18
|
+
define_method(:yellow) { |s| "\e[33m" + s.to_s + "\e[0m" }
|
19
|
+
define_method(:blue) { |s| "\e[34m" + s.to_s + "\e[0m" }
|
20
|
+
define_method(:magenta) { |s| "\e[35m" + s.to_s + "\e[0m" }
|
21
|
+
define_method(:cyan) { |s| "\e[36m" + s.to_s + "\e[0m" }
|
22
|
+
define_method(:white) { |s| "\e[37m" + s.to_s + "\e[0m" }
|
23
|
+
|
24
|
+
def replace_colors(match)
|
25
|
+
output = match.to_a[0]
|
26
|
+
color_lookup_list = match.named_captures.invert
|
3
27
|
|
4
|
-
|
5
|
-
|
28
|
+
match.to_a[1..-1].each do |s|
|
29
|
+
next unless s
|
6
30
|
|
7
|
-
|
8
|
-
end
|
31
|
+
output.gsub!(s, Hilight.send(color_lookup_list[s], s))
|
32
|
+
end
|
9
33
|
|
10
|
-
|
11
|
-
|
12
|
-
raise ArgumentError, "#{input} is not a kind of Array or Regexp" unless regexps.is_a?(Array) || regexps.is_a?(Regexp)
|
34
|
+
output
|
35
|
+
end
|
13
36
|
|
14
|
-
|
37
|
+
def raise_or_continue(input, regexps)
|
38
|
+
raise ArgumentError, "#{input} is not a kind of String" unless input.is_a? String
|
39
|
+
raise ArgumentError, "#{input} is not a kind of Array or Regexp" unless regexps.is_a?(Array) || regexps.is_a?(Regexp)
|
40
|
+
end
|
15
41
|
|
16
|
-
|
17
|
-
|
42
|
+
def transform(input, regexps = [])
|
43
|
+
raise_or_continue input, regexps
|
44
|
+
unioned_regexp = regexps.is_a?(Array) ? Regexp.union(regexps) : regexps
|
18
45
|
|
19
|
-
|
20
|
-
|
21
|
-
output.push match.pre_match unless match.pre_match.empty?
|
46
|
+
match = unioned_regexp.match input
|
47
|
+
return input unless match
|
22
48
|
|
23
|
-
|
24
|
-
|
49
|
+
output = []
|
50
|
+
while match
|
51
|
+
output.push match.pre_match unless match.pre_match.empty?
|
25
52
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
color = color_lookup_list[s]
|
30
|
-
captured_string.gsub!(s, Term::ANSIColor.color(color, s))
|
31
|
-
end
|
53
|
+
captured_string = replace_colors match
|
54
|
+
output.push captured_string if captured_string
|
32
55
|
|
33
|
-
|
56
|
+
post_match = match.post_match
|
57
|
+
match = unioned_regexp.match(match.post_match)
|
34
58
|
|
35
|
-
|
36
|
-
|
59
|
+
output.push post_match unless match
|
60
|
+
end
|
37
61
|
|
38
|
-
output.
|
62
|
+
output.join("")
|
39
63
|
end
|
40
64
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Hilight::Fabric = Struct.new :pattern, :regexps
|
45
|
-
Hilight::Fabric.define_method(:match?) do |string|
|
46
|
-
raise ArgumentError, "#{string} is not a kind of String" unless string.is_a? String
|
65
|
+
def gem_dir
|
66
|
+
return Dir.pwd unless Gem.loaded_specs.include? 'hilight'
|
47
67
|
|
48
|
-
|
49
|
-
when Symbol then (pattern.to_s == string)
|
50
|
-
when String then (pattern == string)
|
51
|
-
when Regexp then (pattern.match? string.to_s)
|
52
|
-
else false
|
68
|
+
Gem.loaded_specs['hilight'].full_gem_path
|
53
69
|
end
|
54
70
|
end
|
55
|
-
|
56
|
-
Hilight::Fabric.define_method(:transform) do |string|
|
57
|
-
Hilight.transform string, regexps
|
58
|
-
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Hilight::Fabric
|
2
|
+
attr_accessor :regexps
|
3
|
+
attr_accessor :match_pattern
|
4
|
+
|
5
|
+
def initialize(match_pattern, regexps)
|
6
|
+
@regexps = regexps
|
7
|
+
@match_pattern = match_pattern
|
8
|
+
end
|
9
|
+
|
10
|
+
def match?(string)
|
11
|
+
raise ArgumentError, "#{string} is not a kind of String" unless string.is_a? String
|
12
|
+
|
13
|
+
case match_pattern
|
14
|
+
when Symbol then (match_pattern.to_s == string)
|
15
|
+
when String then (match_pattern == string)
|
16
|
+
when Regexp then (match_pattern.match? string.to_s)
|
17
|
+
else false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def transform(string)
|
22
|
+
Hilight.transform string, regexps
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_h
|
26
|
+
{ match_pattern: match_pattern, regexps: regexps.map(&:to_s) }
|
27
|
+
end
|
28
|
+
end
|
data/lib/hilight/pair.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class Hilight::Pattern
|
2
|
+
attr_accessor :pairs
|
3
|
+
|
4
|
+
def initialize(pairs)
|
5
|
+
@pairs = pairs
|
6
|
+
end
|
7
|
+
|
8
|
+
def define_methods
|
9
|
+
pairs.each { |pair| Hilight.define_singleton_method(pair.verb) { |s| "\e[#{pair.code}m#{s}\e[39;49m" } }
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
pairs.map { |p| [p.verb, p.code] }.to_h
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Hilight
|
2
|
+
class Quilt
|
3
|
+
attr_accessor :fabric
|
4
|
+
attr_accessor :pattern
|
5
|
+
|
6
|
+
def initialize(fabric, pattern)
|
7
|
+
@fabric = fabric
|
8
|
+
@pattern = pattern
|
9
|
+
end
|
10
|
+
|
11
|
+
def match?(string)
|
12
|
+
fabric.match? string
|
13
|
+
end
|
14
|
+
|
15
|
+
def transform(string)
|
16
|
+
pattern.define_methods
|
17
|
+
fabric.transform string
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_h
|
21
|
+
{ fabric: fabric.to_h, pattern: pattern.to_h }
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.create_from_hash(hash = {})
|
25
|
+
new(
|
26
|
+
Fabric.new(Regexp.new(hash['fabric']['match_pattern']), hash['fabric']['regexps']
|
27
|
+
.map { |r| Regexp.new r }),
|
28
|
+
Pattern.new(hash['pattern'].map { |k, v| Pair[k.to_s, v] })
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.load_from_gem(name)
|
33
|
+
create_from_hash(
|
34
|
+
JSON.parse(
|
35
|
+
File.read("#{gem_dir}/data/quilts/#{name}_quilt.json")
|
36
|
+
)
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Hilight
|
2
|
+
module Quilts
|
3
|
+
Default = Quilt.create_from_hash(
|
4
|
+
"fabric" => {
|
5
|
+
"match_pattern" => "default",
|
6
|
+
"regexps" => [
|
7
|
+
"(?-mix:(?<argument>\\B-{1,2}[\\w-]+)|(?<boundary>[\\[\\]\\(\\)\\{\\}\\<\\>])|(?<string>[\"'].*?[\"']))"
|
8
|
+
]
|
9
|
+
},
|
10
|
+
"pattern" => {
|
11
|
+
"argument" => "33",
|
12
|
+
"boundary" => "34",
|
13
|
+
"string" => "32"
|
14
|
+
}
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Hilight
|
2
|
+
module Quilts
|
3
|
+
Help = Quilt.create_from_hash(
|
4
|
+
"fabric" => {
|
5
|
+
"match_pattern" => "(?-mix:-h|--help|help)",
|
6
|
+
"regexps" => [
|
7
|
+
"(?-mix:(?<argument>\\B-{1,2}[\\w-]+)|(?<boundary>[\\[\\]\\(\\)\\{\\}\\<\\>])|(?<string>[\"'].*?[\"']))"
|
8
|
+
]
|
9
|
+
},
|
10
|
+
"pattern" => {
|
11
|
+
"argument" => "33",
|
12
|
+
"boundary" => "34",
|
13
|
+
"string" => "32"
|
14
|
+
}
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Hilight
|
2
|
+
module Quilts
|
3
|
+
Rspec = Quilt.create_from_hash(
|
4
|
+
"fabric" => {
|
5
|
+
"match_pattern" => "rspec",
|
6
|
+
"regexps" => [
|
7
|
+
"(?-mix:(?<test_count>\\d+) examples, (?<test_failures>\\d+) failures?, (?<test_pending>\\d+) pending)",
|
8
|
+
"(?-mix:\"(?<string>.*?)\")",
|
9
|
+
"(?-mix:'(?<string>.*?)')",
|
10
|
+
"(?-mix:# (?<line>.*):(?<line_number>\\d+))"
|
11
|
+
]
|
12
|
+
},
|
13
|
+
"pattern" => {
|
14
|
+
"string" => "38;2;229;92;7",
|
15
|
+
"test_count" => "32",
|
16
|
+
"test_failures" => "31",
|
17
|
+
"test_pending" => "33",
|
18
|
+
"line" => "36",
|
19
|
+
"line_number" => "38;2;100;100;100"
|
20
|
+
}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Hilight
|
2
|
+
module Quilts
|
3
|
+
Ruby = Quilt.create_from_hash(
|
4
|
+
'fabric' => {
|
5
|
+
'match_pattern' => "ruby",
|
6
|
+
'regexps' => [
|
7
|
+
/\"(?<string>.*?)\"/,
|
8
|
+
/'(?<string>.*?)'/
|
9
|
+
]
|
10
|
+
},
|
11
|
+
'pattern' => { "string" => "31", "comment" => "32" }
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
data/lib/hilight/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hilight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Brodeur
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: term-ansicolor
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,11 +43,23 @@ files:
|
|
57
43
|
- README.md
|
58
44
|
- Rakefile
|
59
45
|
- bin/add
|
46
|
+
- bin/add_theme
|
60
47
|
- bin/console
|
48
|
+
- bin/convert_vscode
|
49
|
+
- bin/generate_theme
|
61
50
|
- bin/setup
|
62
51
|
- exe/hilight
|
63
52
|
- hilight.gemspec
|
64
53
|
- lib/hilight.rb
|
54
|
+
- lib/hilight/fabric.rb
|
55
|
+
- lib/hilight/pair.rb
|
56
|
+
- lib/hilight/pattern.rb
|
57
|
+
- lib/hilight/quilt.rb
|
58
|
+
- lib/hilight/quilts.rb
|
59
|
+
- lib/hilight/quilts/default.rb
|
60
|
+
- lib/hilight/quilts/help.rb
|
61
|
+
- lib/hilight/quilts/rspec.rb
|
62
|
+
- lib/hilight/quilts/ruby.rb
|
65
63
|
- lib/hilight/version.rb
|
66
64
|
homepage:
|
67
65
|
licenses: []
|