thicket 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thicket/log.rb +10 -7
- data/lib/thicket/version.rb +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: 78d11e58027823d2bc19891269bdcf93c6b8d5ed8396cef5fe275f75282e27c9
|
4
|
+
data.tar.gz: 99e6feb765c64cb6359b8014d26014812620d76185424695fa07103cf480c57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99a311df3ab8cddbc14ac9d9d52f16a51762c9505f9eca6aae22a069eb486b351e6cdc45bc935a53e806bc83111f9daf8579ff8d4bad7561b3bd359529117143
|
7
|
+
data.tar.gz: 4130465a692a997d098b30f776c7bfe46ed04bf1c53c93f927fb6c7066dd9569ce1eea4e32668f183570dd24d65627643f2883f900ba8b8ee3f9ba2848cfddae
|
data/lib/thicket/log.rb
CHANGED
@@ -5,7 +5,7 @@ require "time"
|
|
5
5
|
|
6
6
|
module Thicket
|
7
7
|
class Log
|
8
|
-
LOG_PARSE_REGEX = /[a-f0-9]{7}.+?m(.+?) .+?m\{(
|
8
|
+
LOG_PARSE_REGEX = /[a-f0-9]{7}.+?m(.+?) .+?m\{(.+?)\}.+?m (?:\((.+?)\))?.+?m(.+$)/.freeze
|
9
9
|
|
10
10
|
def initialize(options)
|
11
11
|
@options = options
|
@@ -40,9 +40,9 @@ module Thicket
|
|
40
40
|
@padding_char = @padding_char == " " ? "-" : " "
|
41
41
|
|
42
42
|
line.match(LOG_PARSE_REGEX) do |matcher|
|
43
|
-
process_date_time(matcher[1], line, matcher[3])
|
44
|
-
process_message_prefix(matcher[4], line) if @options[:color_prefixes]
|
45
|
-
process_author_name(matcher[2], line)
|
43
|
+
line = process_date_time(matcher[1], line, matcher[3])
|
44
|
+
line = process_message_prefix(matcher[4], line) if @options[:color_prefixes]
|
45
|
+
line = process_author_name(matcher[2], line)
|
46
46
|
@count_parsed += 1
|
47
47
|
end
|
48
48
|
|
@@ -57,7 +57,8 @@ module Thicket
|
|
57
57
|
quantity = (seconds_ago / measure.length).floor
|
58
58
|
to_sub = +"#{quantity}#{measure.abbreviation}".rjust(3)
|
59
59
|
to_sub << "\e[31m" if have_refs # add color if we have refs in this line
|
60
|
-
|
60
|
+
|
61
|
+
line.sub(time_string, to_sub)
|
61
62
|
end
|
62
63
|
|
63
64
|
# Takes an input log string and commit message, finds commit messages
|
@@ -66,8 +67,10 @@ module Thicket
|
|
66
67
|
prefix_regex = %r{^(?=.*[0-9])([A-Z\d-]+?[: \/])}
|
67
68
|
message.match(prefix_regex) do |matcher|
|
68
69
|
prefix = matcher[1]
|
69
|
-
line.sub
|
70
|
+
return line.sub(/([^\/])#{prefix}/, "\\1\e[30m#{prefix}\e[m")
|
70
71
|
end
|
72
|
+
|
73
|
+
line
|
71
74
|
end
|
72
75
|
|
73
76
|
# Takes an input log string and commit author, and moves it from the normal
|
@@ -81,7 +84,7 @@ module Thicket
|
|
81
84
|
total_length = strip_color(line).length
|
82
85
|
spaces_needed = terminal_width - total_length - author.length - 2
|
83
86
|
if spaces_needed < 0
|
84
|
-
line = +"#{line[0...-spaces_needed - 5]}...
|
87
|
+
line = +"#{line[0...-spaces_needed - 5]}... "
|
85
88
|
else
|
86
89
|
line << " \e[30m"
|
87
90
|
line << @padding_char * spaces_needed
|
data/lib/thicket/version.rb
CHANGED