colora 0.1.240114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +112 -0
- data/bin/colora +46 -0
- data/lib/colora/configure.rb +40 -0
- data/lib/colora/data.rb +83 -0
- data/lib/colora/lines.rb +108 -0
- data/lib/colora/plugs/diff.rb +67 -0
- data/lib/colora/plugs/markdown.rb +18 -0
- data/lib/colora.rb +32 -0
- metadata +236 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a3760588ff62affbf6a8f1c58a95e9d76415d77db9fd9d214a783e51dad1d177
|
4
|
+
data.tar.gz: 6422c39bc7dc14d01575da4af643f5029a06f8e7db15a22fff72655ba468b199
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 87dcb061cc8f77823edda88f80ad60f3c5abc3bccd199504cbab391c7615853b58e682b04d97b9fa2cee5665dfb9e46b2a8fe35e05184724c984d71526ac5b9b
|
7
|
+
data.tar.gz: c17e22167482923f6900ba3e614bdf25cee992496fe789d6a57cc344b0821653b9585cf22ed106960b483c0bac451780bff7035b929b82cdb5d83636cf2b43cd
|
data/README.md
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
# Colora
|
2
|
+
|
3
|
+
* [VERSION 0.1.240114](https://github.com/carlosjhr64/colora/releases)
|
4
|
+
* [github](https://www.github.com/carlosjhr64/colora)
|
5
|
+
* [rubygems](https://rubygems.org/carlosjhr64/colora)
|
6
|
+
|
7
|
+
## DESCRIPTION
|
8
|
+
|
9
|
+
Colorizes terminal outputs.
|
10
|
+
|
11
|
+
Uses `Rouge::Formatters::Terminal256` to theme/color output to the terminal.
|
12
|
+
Color codes git diff.
|
13
|
+
|
14
|
+
## INSTALL
|
15
|
+
```console
|
16
|
+
$ gem install colora
|
17
|
+
```
|
18
|
+
## SYNOPSIS
|
19
|
+
```console
|
20
|
+
$ colora ./README.md # Color outputs file
|
21
|
+
$ cat README.md | colora # Colorizing filter
|
22
|
+
$ colora --git lib # Git-diff with target
|
23
|
+
$ colora # Git-diff default
|
24
|
+
```
|
25
|
+
## GIT-DIFF FILTERING
|
26
|
+
|
27
|
+
![Demo](img/demo.png)
|
28
|
+
|
29
|
+
Colora will decorate your git-diff output with the following additional flags:
|
30
|
+
|
31
|
+
* Absent: `*`
|
32
|
+
* Deleted: `<`
|
33
|
+
* Inserted: `>`
|
34
|
+
* Moved/Touched: `t`
|
35
|
+
* Edited: `e`
|
36
|
+
* Duplicated: `d`
|
37
|
+
|
38
|
+
The flags are the first three characters of the diff line,
|
39
|
+
the first coming from git.
|
40
|
+
The second and third refer to the code and comment of the diff line
|
41
|
+
(Colora assumes comments as in Ruby).
|
42
|
+
One can choose to filter(via command line options) the diff output to:
|
43
|
+
|
44
|
+
* Filter out context lines(quiet)
|
45
|
+
* Just view green(inserted lines)
|
46
|
+
* Just view red(deleted lines)
|
47
|
+
* Just view edited code or comments
|
48
|
+
* Just view duplicated code or comments
|
49
|
+
|
50
|
+
Additional features:
|
51
|
+
|
52
|
+
* Swap tabs with tab symbol
|
53
|
+
* Switch to a different theme(as provided by Rouge)
|
54
|
+
|
55
|
+
## HELP
|
56
|
+
```console
|
57
|
+
$ colora --help
|
58
|
+
Usage:
|
59
|
+
colora [:options+] [<file=FILE>]
|
60
|
+
Options:
|
61
|
+
-q --quiet
|
62
|
+
-g --green Skip red: /^[-<]/
|
63
|
+
-r --red Skip green: /^[+>]/
|
64
|
+
-c --code Show only new(changed) code
|
65
|
+
-C --comment Show only new(changed) comments
|
66
|
+
-d --dupcode Show only duplicate code
|
67
|
+
-D --dupcomment Show only duplicate comments
|
68
|
+
-G --git Run git-diff
|
69
|
+
-t --tab Swap tab with ⇥
|
70
|
+
--theme=NAME Rouge theme(default: github)
|
71
|
+
--lang=NAME Language being diffed(default: ruby)
|
72
|
+
Types:
|
73
|
+
FILE /^[-\w\.\/]+$/
|
74
|
+
NAME /^[\d.a-z_]+$/
|
75
|
+
Exclusive:
|
76
|
+
green red
|
77
|
+
# Notes: #
|
78
|
+
When no FILE is given and STDIN in a TTY, git-diff is run.
|
79
|
+
Known themes:
|
80
|
+
base16 base16.monokai base16.solarized bw
|
81
|
+
colorful
|
82
|
+
github gruvbox
|
83
|
+
igorpro
|
84
|
+
magritte molokai monokai monokai.sublime
|
85
|
+
pastie
|
86
|
+
thankful_eyes tulip
|
87
|
+
```
|
88
|
+
## LICENSE
|
89
|
+
|
90
|
+
Copyright (c) 2024 CarlosJHR64
|
91
|
+
|
92
|
+
Permission is hereby granted, free of charge,
|
93
|
+
to any person obtaining a copy of this software and
|
94
|
+
associated documentation files (the "Software"),
|
95
|
+
to deal in the Software without restriction,
|
96
|
+
including without limitation the rights
|
97
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
98
|
+
copies of the Software, and
|
99
|
+
to permit persons to whom the Software is furnished to do so,
|
100
|
+
subject to the following conditions:
|
101
|
+
|
102
|
+
The above copyright notice and this permission notice
|
103
|
+
shall be included in all copies or substantial portions of the Software.
|
104
|
+
|
105
|
+
THE SOFTWARE IS PROVIDED "AS IS",
|
106
|
+
WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
107
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
108
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
109
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
110
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
111
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
112
|
+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/colora
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'colora'
|
3
|
+
|
4
|
+
def parse_argv
|
5
|
+
return nil if ARGV.empty?
|
6
|
+
|
7
|
+
require 'help_parser'
|
8
|
+
HelpParser[Colora::VERSION, <<~HELP]
|
9
|
+
Usage:
|
10
|
+
colora [:options+] [<file=FILE>]
|
11
|
+
Options:
|
12
|
+
-q --quiet
|
13
|
+
-g --green \t Skip red: /^[-<]/
|
14
|
+
-r --red \t Skip green: /^[+>]/
|
15
|
+
-c --code \t Show only new(changed) code
|
16
|
+
-C --comment \t Show only new(changed) comments
|
17
|
+
-d --dupcode \t Show only duplicate code
|
18
|
+
-D --dupcomment\t Show only duplicate comments
|
19
|
+
-G --git \t Run git-diff
|
20
|
+
-t --tab \t Swap tab with ⇥
|
21
|
+
--theme=NAME \t Rouge theme(default: github)
|
22
|
+
--lang=NAME \t Language being diffed(default: ruby)
|
23
|
+
Types:
|
24
|
+
FILE /^[-\\w\\.\\/]+$/
|
25
|
+
NAME /^[\\d.a-z_]+$/
|
26
|
+
Exclusive:
|
27
|
+
green red
|
28
|
+
# Notes: #
|
29
|
+
When no FILE is given and STDIN in a TTY, git-diff is run.
|
30
|
+
Known themes:
|
31
|
+
base16 base16.monokai base16.solarized bw
|
32
|
+
colorful
|
33
|
+
github gruvbox
|
34
|
+
igorpro
|
35
|
+
magritte molokai monokai monokai.sublime
|
36
|
+
pastie
|
37
|
+
thankful_eyes tulip
|
38
|
+
HELP
|
39
|
+
end
|
40
|
+
|
41
|
+
options = parse_argv
|
42
|
+
begin
|
43
|
+
Colora.run(options)
|
44
|
+
rescue Colora::Error => e
|
45
|
+
warn e.message
|
46
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Colora
|
2
|
+
Config = OpenStruct.new
|
3
|
+
|
4
|
+
# Options:
|
5
|
+
Config.file = nil
|
6
|
+
Config.git = false
|
7
|
+
Config.lang = 'ruby'
|
8
|
+
Config.theme = 'github'
|
9
|
+
Config.tab = false
|
10
|
+
|
11
|
+
# Filter keys:
|
12
|
+
FILTERS = %i[quiet green red code comment dupcode dupcomment]
|
13
|
+
FILTERS.each{Config[_1]=false}
|
14
|
+
|
15
|
+
# Flags colors:
|
16
|
+
Config.duplicated_flag = [:default, '#E0FFFF'] # LightCyan
|
17
|
+
Config.inserted_flag = [:default, '#ADD8E6'] # LightBlue
|
18
|
+
Config.edited_flag = [:default, '#90EE90'] # LightGreen
|
19
|
+
|
20
|
+
# Comments colors:
|
21
|
+
Config.moved_comment = ['#A9A9A9', :default] # DarkGray
|
22
|
+
Config.duplicated_comment = ['#008B8B', :default] # DarkCyan
|
23
|
+
Config.inserted_comment = ['#00008B', :default] # DarkBlue
|
24
|
+
Config.edited_comment = ['#006400', :default] # DarkGreen
|
25
|
+
|
26
|
+
def self.configure(options)
|
27
|
+
# FILE:
|
28
|
+
Config.file = options.file if options.file
|
29
|
+
|
30
|
+
# Options:
|
31
|
+
Config.theme = options.theme if options.theme?
|
32
|
+
Config.lang = options.lang if options.lang?
|
33
|
+
Config.git = options.git?
|
34
|
+
Config.tab = options.tab?
|
35
|
+
|
36
|
+
# Filters:
|
37
|
+
# Config.quiet=options.quiet? ...
|
38
|
+
FILTERS.each{Config[_1]=options.send("#{_1}?")}
|
39
|
+
end
|
40
|
+
end
|
data/lib/colora/data.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
module Colora
|
2
|
+
class Data
|
3
|
+
SPLIT = lambda do |line|
|
4
|
+
flag = line[0]
|
5
|
+
code, pounds, comment = line[1..].split(/(?<!['"])(\s*#+)(?!{)/, 2)
|
6
|
+
code = nil if code.empty?
|
7
|
+
comment ? [flag, code, pounds+comment] : [flag, code, nil]
|
8
|
+
end
|
9
|
+
UPDATE = lambda do |hash, key, flag|
|
10
|
+
k = key.strip
|
11
|
+
hash[k] = case hash[k]
|
12
|
+
when nil
|
13
|
+
flag # added(+>) or removed(-<)
|
14
|
+
when 'd', 't', flag
|
15
|
+
'd' # duplicate
|
16
|
+
else
|
17
|
+
't' # touched
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def pre_process(line)
|
22
|
+
# rubocop:disable Lint/DuplicateBranch
|
23
|
+
case line.rstrip
|
24
|
+
when '', '+', '-', '---', /^[-+][-+][-+] [ab]/
|
25
|
+
line
|
26
|
+
when /^[-+<>]/
|
27
|
+
flag, code, comment = SPLIT[line]
|
28
|
+
f = flag=='-' ? '<' : flag=='+' ? '>' : flag
|
29
|
+
UPDATE[@codes, code, f] if code
|
30
|
+
UPDATE[@comments, comment, f] if comment
|
31
|
+
[flag, code, comment]
|
32
|
+
else
|
33
|
+
line
|
34
|
+
end
|
35
|
+
# rubocop:enable Lint/DuplicateBranch
|
36
|
+
end
|
37
|
+
|
38
|
+
attr_reader :lines
|
39
|
+
|
40
|
+
def initialize(lines)
|
41
|
+
@lines,@codes,@comments,@edits = [],{},{},Set.new
|
42
|
+
while (line = lines.shift)
|
43
|
+
@lines << pre_process(line)
|
44
|
+
end
|
45
|
+
populate_edits
|
46
|
+
@lines.each do |line|
|
47
|
+
next unless line.is_a?(Array)
|
48
|
+
post_process line
|
49
|
+
end
|
50
|
+
@codes = @comments = @edits = nil # GC
|
51
|
+
end
|
52
|
+
|
53
|
+
def populate_edits
|
54
|
+
partners = []
|
55
|
+
jarrow = FuzzyStringMatch::JaroWinkler.create(:pure) # Need pure for UTF-8
|
56
|
+
removed = @codes.select{|_,flag| '-<'.include?flag}.keys
|
57
|
+
added = @codes.select{|_,flag| '+>'.include?flag}.keys
|
58
|
+
short, long = [removed, added].sort_by(&:length)
|
59
|
+
short.each do |a|
|
60
|
+
long.each do |b|
|
61
|
+
d = jarrow.getDistance(a, b)
|
62
|
+
partners.push([a, b, d]) if d > 0.618034
|
63
|
+
end
|
64
|
+
end
|
65
|
+
partners.sort_by(&:last).reverse.each do |a, b, _|
|
66
|
+
next if @edits.include?(a) || @edits.include?(b)
|
67
|
+
@edits.add(a)
|
68
|
+
@edits.add(b)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def post_process(line)
|
73
|
+
if (code = line[1]&.strip)
|
74
|
+
flag = @edits.include?(code) ? 'e' : @codes[code]
|
75
|
+
line[1] = [flag, line[1]]
|
76
|
+
end
|
77
|
+
if (comment = line[2]&.strip)
|
78
|
+
flag = @comments[comment]
|
79
|
+
line[2] = [flag, line[2]]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/colora/lines.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
module Colora
|
2
|
+
class Lines
|
3
|
+
def formatter
|
4
|
+
theme = Rouge::Theme.find(Config.theme)
|
5
|
+
raise Error, "Unrecognized theme: #{Config.theme}" unless theme
|
6
|
+
Rouge::Formatters::Terminal256.new(theme.new)
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_lexer_by_file(file = Config.file)
|
10
|
+
return nil unless file && !File.extname(file).empty?
|
11
|
+
Rouge::Lexer.guess_by_filename(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_lexer_by_source(source)
|
15
|
+
case source
|
16
|
+
when /^---/, /^# /
|
17
|
+
Rouge::Lexer.guess_by_filename('*.md')
|
18
|
+
else
|
19
|
+
Rouge::Lexer.guess_by_source(source)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def filehandle
|
24
|
+
Config.git ? IO.popen("git diff #{Config.file}") :
|
25
|
+
Config.file ? File.open(Config.file) :
|
26
|
+
$stdin
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_lines(fh = filehandle)
|
30
|
+
fh.readlines.map(&:chomp)
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize
|
34
|
+
@formatter = formatter
|
35
|
+
lines = get_lines
|
36
|
+
@lexer = @orig_lexer = get_lexer_by_file || get_lexer_by_source(lines[0])
|
37
|
+
@tag = @lexer.tag
|
38
|
+
@lines = @tag=='diff' ? Data.new(lines).lines : lines
|
39
|
+
@lang = @orig_lang = Rouge::Lexer.find_fancy(Config.lang)
|
40
|
+
@pad0 = ' '
|
41
|
+
@pad1 = ' '
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_a = @lines
|
45
|
+
|
46
|
+
def filtered?(line)
|
47
|
+
return false if line.is_a?(String)
|
48
|
+
|
49
|
+
(Config.green && '-<'.include?(line[0])) ||
|
50
|
+
(Config.red && '+>'.include?(line[0])) ||
|
51
|
+
(Config.code && [nil,'t'].include?(line.dig 1,0)) ||
|
52
|
+
(Config.comment && [nil, 't'].include?(line.dig 2,0)) ||
|
53
|
+
(Config.dupcode && line.dig(1,0)=='d') ||
|
54
|
+
(Config.dupcomment && line.dig(2,0)=='d') ||
|
55
|
+
false
|
56
|
+
end
|
57
|
+
|
58
|
+
def pad(line)
|
59
|
+
@pad0+line
|
60
|
+
end
|
61
|
+
|
62
|
+
def flags(line)
|
63
|
+
line[0] + (line.dig(1,0)||'*') + (line.dig(2,0)||'*') + @pad1
|
64
|
+
end
|
65
|
+
|
66
|
+
def format(line, color=nil)
|
67
|
+
case color
|
68
|
+
when nil
|
69
|
+
@formatter.format(@lexer.lex(line))
|
70
|
+
when :lang
|
71
|
+
@formatter.format(@lang.lex(line))
|
72
|
+
else
|
73
|
+
Paint[line, *color]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def reset_lang_by_source(source)
|
78
|
+
@lang = Rouge::Lexer.guess_by_source(source)
|
79
|
+
end
|
80
|
+
|
81
|
+
def reset_lang_by_filename(file)
|
82
|
+
@lang = Rouge::Lexer.guess_by_filename(file)
|
83
|
+
end
|
84
|
+
|
85
|
+
def reset_lexer(lang=nil)
|
86
|
+
@lexer = lang.nil? ? @orig_lexer :
|
87
|
+
(Rouge::Lexer.find_fancy(lang) || @orig_lexer)
|
88
|
+
end
|
89
|
+
|
90
|
+
def reset_lang(lang=nil)
|
91
|
+
@lang = lang.nil? ? @orig_lang :
|
92
|
+
(Rouge::Lexer.find_fancy(lang) || @orig_lang)
|
93
|
+
end
|
94
|
+
|
95
|
+
def each
|
96
|
+
@lines.each do |line|
|
97
|
+
next if filtered?(line)
|
98
|
+
|
99
|
+
# Is there a plugin for @tag? If so, use it: Else use the lexer.
|
100
|
+
txt = respond_to?(@tag) ? send(@tag, line) :
|
101
|
+
@formatter.format(@lexer.lex(line))
|
102
|
+
yield txt if txt
|
103
|
+
end
|
104
|
+
reset_lexer
|
105
|
+
reset_lang
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Colora
|
2
|
+
class Lines
|
3
|
+
def diff(line)
|
4
|
+
case line
|
5
|
+
when String
|
6
|
+
case line
|
7
|
+
when /^[-+][-+][-+] [ab]\/(.*)$/
|
8
|
+
reset_lang_by_filename($~[1])
|
9
|
+
format(line)
|
10
|
+
when /^\s*#!/
|
11
|
+
reset_lang_by_source(line)
|
12
|
+
format(line) unless Config.quiet
|
13
|
+
when /^ /
|
14
|
+
format(pad(line), :lang) unless Config.quiet
|
15
|
+
else
|
16
|
+
format(line) unless Config.quiet
|
17
|
+
end
|
18
|
+
else
|
19
|
+
# Initialized text variables
|
20
|
+
txt = ''
|
21
|
+
flags = flags(line)
|
22
|
+
code = line.dig(1,1)||''
|
23
|
+
comment = line.dig(2,1)||''
|
24
|
+
# txt << flags+code
|
25
|
+
case line[0]
|
26
|
+
when '-', '<'
|
27
|
+
txt << format(flags+code+comment)
|
28
|
+
comment = '' # will skip commenting below
|
29
|
+
when '+', '>'
|
30
|
+
case line.dig(1,0)
|
31
|
+
when nil, 't'
|
32
|
+
txt << format(flags+code)
|
33
|
+
when 'd'
|
34
|
+
txt << format(flags, Config.dupplicated_flag)
|
35
|
+
txt << format(code, :lang)
|
36
|
+
when '>'
|
37
|
+
txt << format(flags, Config.inserted_flag)
|
38
|
+
txt << format(code, :lang)
|
39
|
+
when 'e'
|
40
|
+
txt << format(flags, Config.edited_flag)
|
41
|
+
txt << format(code, :lang)
|
42
|
+
else
|
43
|
+
warn "Unknown code type: #{line[0]}"
|
44
|
+
end
|
45
|
+
else
|
46
|
+
warn "Unknown line type: #{line[0]}"
|
47
|
+
end
|
48
|
+
# txt << comment
|
49
|
+
unless comment.empty?
|
50
|
+
case line.dig(2,0)
|
51
|
+
when 't'
|
52
|
+
txt << format(comment, Config.moved_comment)
|
53
|
+
when 'd'
|
54
|
+
txt << format(comment, Config.dupplicated_comment)
|
55
|
+
when '>'
|
56
|
+
txt << format(comment, Config.inserted_comment)
|
57
|
+
when 'e'
|
58
|
+
txt << format(comment, Config.edited_comment)
|
59
|
+
else
|
60
|
+
warn "Unknown comment type: #{line[0]}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
txt
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Colora
|
2
|
+
class Lines
|
3
|
+
def markdown(line)
|
4
|
+
txt = nil
|
5
|
+
case line
|
6
|
+
when /^```(\w+)$/
|
7
|
+
txt = format(line)
|
8
|
+
reset_lexer($~[1])
|
9
|
+
when /^```$/
|
10
|
+
reset_lexer
|
11
|
+
txt = format(line)
|
12
|
+
else
|
13
|
+
txt = format(line)
|
14
|
+
end
|
15
|
+
txt
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/colora.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Colora
|
2
|
+
class Error < RuntimeError; end
|
3
|
+
VERSION = '0.1.240114'
|
4
|
+
|
5
|
+
# Colora.run(options)
|
6
|
+
def self.run(options=nil)
|
7
|
+
# Standard libraries:
|
8
|
+
require 'ostruct'
|
9
|
+
# Gems:
|
10
|
+
require 'fuzzystringmatch'
|
11
|
+
require 'paint'
|
12
|
+
require 'rouge'
|
13
|
+
# Colora:
|
14
|
+
require_relative 'colora/configure'
|
15
|
+
require_relative 'colora/data'
|
16
|
+
require_relative 'colora/lines'
|
17
|
+
# Plugs:
|
18
|
+
require_relative 'colora/plugs/diff'
|
19
|
+
require_relative 'colora/plugs/markdown'
|
20
|
+
|
21
|
+
# Configure Colora:
|
22
|
+
Colora.configure(options) if options
|
23
|
+
# By default, run git-diff:
|
24
|
+
Config.git = true if $stdin.tty? && !Config.file
|
25
|
+
|
26
|
+
# Puts Colora::Lines
|
27
|
+
Lines.new.each do |line|
|
28
|
+
line.gsub!("\t", '⇥') if Config.tab
|
29
|
+
puts line
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: colora
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.240114
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- CarlosJHR64
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-01-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fuzzy-string-match
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: help_parser
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '8.2'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 8.2.230210
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '8.2'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 8.2.230210
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: paint
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.3'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.3.0
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.3'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.3.0
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: rouge
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '4.2'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.2.0
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.2'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 4.2.0
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: colorize
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.1'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.1.0
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.1'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.1.0
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: cucumber
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '9.1'
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 9.1.1
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '9.1'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 9.1.1
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: parser
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.3'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 3.3.0
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '3.3'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.3.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.59'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 1.59.0
|
163
|
+
type: :development
|
164
|
+
prerelease: false
|
165
|
+
version_requirements: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '1.59'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 1.59.0
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: test-unit
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '3.6'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 3.6.1
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '3.6'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 3.6.1
|
193
|
+
description: |
|
194
|
+
Colorizes terminal outputs.
|
195
|
+
|
196
|
+
Uses `Rouge::Formatters::Terminal256` to theme/color output to the terminal.
|
197
|
+
Color codes git diff.
|
198
|
+
email: carlosjhr64@gmail.com
|
199
|
+
executables:
|
200
|
+
- colora
|
201
|
+
extensions: []
|
202
|
+
extra_rdoc_files: []
|
203
|
+
files:
|
204
|
+
- README.md
|
205
|
+
- bin/colora
|
206
|
+
- lib/colora.rb
|
207
|
+
- lib/colora/configure.rb
|
208
|
+
- lib/colora/data.rb
|
209
|
+
- lib/colora/lines.rb
|
210
|
+
- lib/colora/plugs/diff.rb
|
211
|
+
- lib/colora/plugs/markdown.rb
|
212
|
+
homepage: https://github.com/carlosjhr64/colora
|
213
|
+
licenses:
|
214
|
+
- MIT
|
215
|
+
metadata: {}
|
216
|
+
post_install_message:
|
217
|
+
rdoc_options: []
|
218
|
+
require_paths:
|
219
|
+
- lib
|
220
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
222
|
+
- - ">="
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: '0'
|
225
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
requirements:
|
231
|
+
- 'git: 2.30'
|
232
|
+
rubygems_version: 3.5.4
|
233
|
+
signing_key:
|
234
|
+
specification_version: 4
|
235
|
+
summary: Colorizes terminal outputs.
|
236
|
+
test_files: []
|