cureutils 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/.gitmodules +3 -0
- data/README.md +2 -1
- data/cureutils.gemspec +1 -1
- data/lib/cureutils/cli.rb +16 -16
- data/lib/cureutils/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc63c6680e85d32c4f482a6b7143ed547b5254ff
|
4
|
+
data.tar.gz: 0312bf5915a8cc686893e57bad63b9f8a95de76a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ff49a261c99d507eed2d0f8c3ded219c055d0ccb846e63f5cf22f75931980a3dad54c39664a57210ad8c8c2a2e886b4ad40ab0b63290412724f4f67d5a8839a
|
7
|
+
data.tar.gz: a83f4bb95fd8ec8bde4e9019527ef5062d671078ac3900156346253223abbd3ffcef06d223ecc531ba387fae3af0749dcb458d4cf04b21a2d42442def613053b
|
data/.gitmodules
ADDED
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
</p>
|
4
4
|
|
5
5
|
# Cureutils
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/cureutils.svg)](https://badge.fury.io/rb/cureutils)
|
6
7
|
|
7
8
|
Useful command line tool for Japanese battle heroine "Pretty Cure (Precure)".
|
8
9
|
|
@@ -13,7 +14,7 @@ Install it yourself as:
|
|
13
14
|
$ gem install cureutils
|
14
15
|
|
15
16
|
|
16
|
-
After that, `cure` command is
|
17
|
+
After that, `cure` command is available.
|
17
18
|
|
18
19
|
$ cure
|
19
20
|
|
data/cureutils.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency 'rake', '~> 10.0'
|
21
21
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
22
22
|
spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
|
23
|
-
spec.add_dependency 'rubicure', '~> 0.4
|
23
|
+
spec.add_dependency 'rubicure', '~> 0.4'
|
24
24
|
spec.add_dependency 'colorize', '~> 0.7.7'
|
25
25
|
spec.add_dependency 'activesupport', '~> 4.2.6'
|
26
26
|
end
|
data/lib/cureutils/cli.rb
CHANGED
@@ -49,43 +49,43 @@ module Cureutils
|
|
49
49
|
end
|
50
50
|
|
51
51
|
desc 'grep [OPTIONS] PATTERN', 'Print lines matching a pattern.'
|
52
|
-
option 'extended-regexp', aliases: 'E'
|
53
|
-
|
54
|
-
|
52
|
+
option 'extended-regexp', aliases: 'E',
|
53
|
+
type: :boolean,
|
54
|
+
desc: 'Disable Precure Bracket Expression.'
|
55
|
+
option 'only-matching', aliases: 'o',
|
56
|
+
type: :boolean,
|
57
|
+
desc: 'Print only the matched parts of a matching line.'
|
58
|
+
def grep(default_pat = '[:precure_name:]', filename = nil)
|
55
59
|
# Check whether the file is given or not
|
56
60
|
@input = input_from(filename)
|
57
|
-
|
58
|
-
|
59
|
-
cure_pat = extended_pat
|
60
|
-
else
|
61
|
-
cure_pat = pregex2regex(pat)
|
62
|
-
end
|
61
|
+
pat = default_pat.clone
|
62
|
+
pat = pregex2regex(default_pat) unless options['extended-regexp'.to_sym]
|
63
63
|
# Check the file discriptor and check the pipe exists or not.
|
64
|
-
|
64
|
+
enable_color = !$stdout.isatty
|
65
65
|
if options['only-matching'.to_sym]
|
66
|
-
if
|
66
|
+
if enable_color
|
67
67
|
@input.each do |line|
|
68
|
-
matched_strs = line.scan(/#{
|
68
|
+
matched_strs = line.scan(/#{pat}/)
|
69
69
|
matched_strs.empty? || matched_strs.each do |str|
|
70
70
|
puts str
|
71
71
|
end
|
72
72
|
end
|
73
73
|
else
|
74
74
|
@input.each do |line|
|
75
|
-
matched_strs = line.scan(/#{
|
75
|
+
matched_strs = line.scan(/#{pat}/)
|
76
76
|
matched_strs.empty? || matched_strs.each do |str|
|
77
77
|
puts str.red
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
81
81
|
else
|
82
|
-
if
|
82
|
+
if enable_color
|
83
83
|
@input.each do |line|
|
84
|
-
puts line.gsub(/#{
|
84
|
+
puts line.gsub(/#{pat}/, '\0') if line =~ /#{pat}/
|
85
85
|
end
|
86
86
|
else
|
87
87
|
@input.each do |line|
|
88
|
-
puts line.gsub(/#{
|
88
|
+
puts line.gsub(/#{pat}/, '\0'.red) if line =~ /#{pat}/
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
data/lib/cureutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cureutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yamada, Yasuhiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.4
|
81
|
+
version: '0.4'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.4
|
88
|
+
version: '0.4'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: colorize
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +123,7 @@ extensions: []
|
|
123
123
|
extra_rdoc_files: []
|
124
124
|
files:
|
125
125
|
- ".gitignore"
|
126
|
+
- ".gitmodules"
|
126
127
|
- ".rspec"
|
127
128
|
- ".travis.yml"
|
128
129
|
- CODE_OF_CONDUCT.md
|