discoball 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/discoball.gemspec +1 -1
- data/lib/discoball.rb +4 -4
- metadata +34 -64
data/README.md
CHANGED
@@ -3,7 +3,8 @@ discoball
|
|
3
3
|
|
4
4
|
`discoball` is a tool to filter streams and colorize patterns. It functions somewhat like `egrep --color`,
|
5
5
|
except that it can highlight multiple patterns (in different colors). Patterns are arbitrary ruby regexes that
|
6
|
-
are matched against the entire line.
|
6
|
+
are matched against the entire line. If the regex contains groupd, only the first group's match text is
|
7
|
+
highlighted.
|
7
8
|
|
8
9
|
Usage
|
9
10
|
-----
|
@@ -56,6 +57,10 @@ Examples
|
|
56
57
|
$ tl # ~> Show the list of tasks, with tags highlighted
|
57
58
|
$ tl health urgent # ~> Show only tasks tagged with 'health' and 'urgent'
|
58
59
|
|
60
|
+
Demo:
|
61
|
+
|
62
|
+
![Discoball + t demo](http://i.imgur.com/tVQMm.png)
|
63
|
+
|
59
64
|
Installation
|
60
65
|
------------
|
61
66
|
|
data/discoball.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "discoball"
|
3
|
-
s.version = "0.2.
|
3
|
+
s.version = "0.2.2"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">=0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
data/lib/discoball.rb
CHANGED
@@ -35,20 +35,20 @@ module Discoball
|
|
35
35
|
case @color_mode
|
36
36
|
when :one_color
|
37
37
|
matches = @patterns.reduce([]) { |memo, pattern| # No Array#flat_map in Ruby 1.8 :\
|
38
|
-
m = line.scan(pattern)
|
38
|
+
m = line.scan(pattern).map { |match| match.is_a?(Array) ? match.first : match }
|
39
39
|
match_found[pattern] = true unless m.empty?
|
40
40
|
memo += m
|
41
41
|
}.uniq
|
42
42
|
matches.each { |match| highlight!(line, match, SINGLE_COLOR) }
|
43
43
|
when :group_colors
|
44
44
|
@patterns.each do |pattern|
|
45
|
-
matches = line.scan(pattern).uniq
|
45
|
+
matches = line.scan(pattern).map { |match| match.is_a?(Array) ? match.first : match }.uniq
|
46
46
|
match_found[pattern] = true unless matches.empty?
|
47
47
|
matches.each { |match| highlight!(line, match, @color_assignments[pattern]) }
|
48
48
|
end
|
49
49
|
when :individual
|
50
50
|
matches = @patterns.reduce([]) { |memo, pattern|
|
51
|
-
m = line.scan(pattern)
|
51
|
+
m = line.scan(pattern).map { |match| match.is_a?(Array) ? match.first : match }
|
52
52
|
match_found[pattern] = true unless m.empty?
|
53
53
|
memo += m
|
54
54
|
}.uniq
|
@@ -79,7 +79,7 @@ module Discoball
|
|
79
79
|
# Get the next color and put it at the back
|
80
80
|
def pop_rotate
|
81
81
|
color = @color_stack.pop
|
82
|
-
@color_stack.
|
82
|
+
@color_stack.unshift color
|
83
83
|
color
|
84
84
|
end
|
85
85
|
end
|
metadata
CHANGED
@@ -1,101 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: discoball
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Caleb Spare
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: colorize
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70347433530760 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 27
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 5
|
33
|
-
- 8
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 0.5.8
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: trollop
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: *70347433530760
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: trollop
|
27
|
+
requirement: &70347433530300 !ruby/object:Gem::Requirement
|
41
28
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 83
|
46
|
-
segments:
|
47
|
-
- 1
|
48
|
-
- 16
|
49
|
-
- 2
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
50
32
|
version: 1.16.2
|
51
33
|
type: :runtime
|
52
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70347433530300
|
53
36
|
description: A simple stream filter to highlight patterns
|
54
37
|
email: cespare@gmail.com
|
55
|
-
executables:
|
38
|
+
executables:
|
56
39
|
- discoball
|
57
40
|
extensions: []
|
58
|
-
|
59
41
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
42
|
+
files:
|
62
43
|
- README.md
|
63
44
|
- discoball.gemspec
|
64
45
|
- lib/discoball.rb
|
65
46
|
- bin/discoball
|
66
|
-
has_rdoc: true
|
67
47
|
homepage: http://github.com/cespare/discoball
|
68
48
|
licenses: []
|
69
|
-
|
70
49
|
post_install_message:
|
71
50
|
rdoc_options: []
|
72
|
-
|
73
|
-
require_paths:
|
51
|
+
require_paths:
|
74
52
|
- lib
|
75
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
54
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
|
82
|
-
- 0
|
83
|
-
version: "0"
|
84
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
60
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
version: "0"
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
93
65
|
requirements: []
|
94
|
-
|
95
66
|
rubyforge_project: discoball
|
96
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.8.7
|
97
68
|
signing_key:
|
98
69
|
specification_version: 2
|
99
70
|
summary: A simple stream filter to highlight patterns
|
100
71
|
test_files: []
|
101
|
-
|