discoball 0.1.0 → 0.2.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.
- data/README.md +2 -2
- data/discoball.gemspec +1 -1
- data/lib/discoball.rb +5 -4
- metadata +22 -1
data/README.md
CHANGED
@@ -19,7 +19,7 @@ where options are:
|
|
19
19
|
* `--help` or `-h`: Print the help message
|
20
20
|
|
21
21
|
Examples
|
22
|
-
|
22
|
+
--------
|
23
23
|
|
24
24
|
* Highlight instances of "foo" and "bar" in the text of `myfile.txt`:
|
25
25
|
|
@@ -27,7 +27,7 @@ Examples
|
|
27
27
|
|
28
28
|
* Highlight paths of processes running out of `/usr/sbin/`:
|
29
29
|
|
30
|
-
$ ps -ef | discoball --
|
30
|
+
$ ps -ef | discoball --one-color --match-any '/usr/sbin/.*$'
|
31
31
|
|
32
32
|
* I wrote discoball for use with [Steve Losh's todo-list tool, t](https://github.com/sjl/t). I put tags on
|
33
33
|
my tasks annotated with `+` (inspired by [Todo.txt](http://todotxt.com/)):
|
data/discoball.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "discoball"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.2.0"
|
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
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "rubygems"
|
3
4
|
require "colorize"
|
4
5
|
|
5
6
|
module Discoball
|
@@ -33,10 +34,10 @@ module Discoball
|
|
33
34
|
|
34
35
|
case @color_mode
|
35
36
|
when :one_color
|
36
|
-
matches = @patterns.
|
37
|
+
matches = @patterns.reduce([]) { |memo, pattern| # No Array#flat_map in Ruby 1.8 :\
|
37
38
|
m = line.scan(pattern)
|
38
39
|
match_found[pattern] = true unless m.empty?
|
39
|
-
m
|
40
|
+
memo += m
|
40
41
|
}.uniq
|
41
42
|
matches.each { |match| highlight!(line, match, SINGLE_COLOR) }
|
42
43
|
when :group_colors
|
@@ -46,10 +47,10 @@ module Discoball
|
|
46
47
|
matches.each { |match| highlight!(line, match, @color_assignments[pattern]) }
|
47
48
|
end
|
48
49
|
when :individual
|
49
|
-
matches = @patterns.
|
50
|
+
matches = @patterns.reduce([]) { |memo, pattern|
|
50
51
|
m = line.scan(pattern)
|
51
52
|
match_found[pattern] = true unless m.empty?
|
52
|
-
m
|
53
|
+
memo += m
|
53
54
|
}.uniq
|
54
55
|
matches.each do |match|
|
55
56
|
unless @color_assignments.include? match
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discoball
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Caleb Spare
|
@@ -21,6 +26,11 @@ dependencies:
|
|
21
26
|
requirements:
|
22
27
|
- - ">="
|
23
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 5
|
33
|
+
- 8
|
24
34
|
version: 0.5.8
|
25
35
|
type: :runtime
|
26
36
|
version_requirements: *id001
|
@@ -32,6 +42,11 @@ dependencies:
|
|
32
42
|
requirements:
|
33
43
|
- - ">="
|
34
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 83
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 16
|
49
|
+
- 2
|
35
50
|
version: 1.16.2
|
36
51
|
type: :runtime
|
37
52
|
version_requirements: *id002
|
@@ -62,12 +77,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
77
|
requirements:
|
63
78
|
- - ">="
|
64
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
65
83
|
version: "0"
|
66
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
85
|
none: false
|
68
86
|
requirements:
|
69
87
|
- - ">="
|
70
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
71
92
|
version: "0"
|
72
93
|
requirements: []
|
73
94
|
|