ruby-zoom 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zoom.rb +21 -14
- data/lib/zoom/profile.rb +7 -0
- data/lib/zoom/profile/ag.rb +1 -1
- data/lib/zoom/profile/pt.rb +30 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54c82ec02a3f8fd56c99f71a28540f2bf2898002
|
4
|
+
data.tar.gz: 47f87ffb3270ee86f957493fda358cd30aedf8f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcf39b5c8eb4ba8f8c71fdb9138641dde45aea9c882c093fb5bebb8b2f29e3f9795841e6c9d0288e0ec3301380aa114035a29d41a1b484eacc73b9a6fe9aa227
|
7
|
+
data.tar.gz: 55a81f2f64ce1864f3ff360481cf495c9cd74dc92d24b172a51db6bb0ecbb63a4b11143414b28d668b9afdf13e0263429897a4e6ea6471a8f0a44bae03010dca
|
data/lib/zoom.rb
CHANGED
@@ -77,13 +77,20 @@ class Zoom
|
|
77
77
|
profiles = Hash.new
|
78
78
|
|
79
79
|
all = nil
|
80
|
+
ag = nil
|
81
|
+
pt = nil
|
82
|
+
ack = nil
|
80
83
|
|
81
84
|
# Default ag profiles
|
82
85
|
if (ScoobyDoo.where_are_you("ag"))
|
83
86
|
ag = Zoom::Profile::Ag.new
|
84
|
-
all = Zoom::Profile::Ag.new(nil, "-
|
85
|
-
|
86
|
-
|
87
|
+
all = Zoom::Profile::Ag.new(nil, "-u")
|
88
|
+
end
|
89
|
+
|
90
|
+
# Default pt profiles
|
91
|
+
if (ScoobyDoo.where_are_you("pt"))
|
92
|
+
pt = Zoom::Profile::Pt.new
|
93
|
+
all ||= Zoom::Profile::Pt.new(nil, "--color -SeU")
|
87
94
|
end
|
88
95
|
|
89
96
|
# Default ack profile
|
@@ -92,20 +99,17 @@ class Zoom
|
|
92
99
|
ScoobyDoo.where_are_you("ack-grep")
|
93
100
|
)
|
94
101
|
ack = Zoom::Profile::Ack.new
|
95
|
-
else
|
96
|
-
ack = nil
|
97
102
|
end
|
98
103
|
|
99
104
|
# Default grep profile (emulate ag/ack as much as possible)
|
100
105
|
grep = Zoom::Profile::Grep.new
|
101
|
-
|
102
|
-
all = Zoom::Profile::Grep.new
|
103
|
-
all.flags("--color=always -EHinR")
|
104
|
-
end
|
106
|
+
all ||= Zoom::Profile::Grep.new(nil, "--color=always -EHinR")
|
105
107
|
|
106
108
|
# Create default profile
|
107
109
|
if (ag)
|
108
110
|
default = ag
|
111
|
+
elsif (pt)
|
112
|
+
default = pt
|
109
113
|
elsif (ack)
|
110
114
|
default = ack
|
111
115
|
else
|
@@ -122,6 +126,7 @@ class Zoom
|
|
122
126
|
profiles["default"] = default
|
123
127
|
profiles["grep"] = grep
|
124
128
|
profiles["passwords"] = Zoom::Profile::Passwords.new
|
129
|
+
profiles["pt"] = pt
|
125
130
|
profiles["zoom_find"] = find
|
126
131
|
rc["profiles"] = profiles
|
127
132
|
|
@@ -248,6 +253,8 @@ class Zoom
|
|
248
253
|
default_op = "grep"
|
249
254
|
if (ScoobyDoo.where_are_you("ag"))
|
250
255
|
default_op = "ag"
|
256
|
+
elsif (ScoobyDoo.where_are_you("pt"))
|
257
|
+
default_op = "pt"
|
251
258
|
elsif (ScoobyDoo.where_are_you("ack"))
|
252
259
|
default_op = "ack"
|
253
260
|
elsif (ScoobyDoo.where_are_you("ack-grep"))
|
@@ -257,6 +264,7 @@ class Zoom
|
|
257
264
|
ack_class = Zoom::Profile::Ack.to_s
|
258
265
|
ag_class = Zoom::Profile::Ag.to_s
|
259
266
|
grep_class = Zoom::Profile::Grep.to_s
|
267
|
+
pt_class = Zoom::Profile::Pt.to_s
|
260
268
|
|
261
269
|
case default_op
|
262
270
|
when "ack", "ack-grep"
|
@@ -265,6 +273,8 @@ class Zoom
|
|
265
273
|
puts "Enter class (default #{ag_class}):"
|
266
274
|
when "grep"
|
267
275
|
puts "Enter class (default #{grep_class}):"
|
276
|
+
when "pt"
|
277
|
+
puts "Enter class (default #{pt_class}):"
|
268
278
|
end
|
269
279
|
|
270
280
|
clas = gets.chomp
|
@@ -277,6 +287,8 @@ class Zoom
|
|
277
287
|
clas = ag_class if (clas.nil? || clas.empty?)
|
278
288
|
when "grep"
|
279
289
|
clas = grep_class if (clas.nil? || clas.empty?)
|
290
|
+
when "pt"
|
291
|
+
clas = pt_class if (clas.nil? || clas.empty?)
|
280
292
|
end
|
281
293
|
|
282
294
|
add_profile(name, clas)
|
@@ -619,8 +631,3 @@ end
|
|
619
631
|
|
620
632
|
require "zoom/error"
|
621
633
|
require "zoom/profile"
|
622
|
-
require "zoom/profile/ack"
|
623
|
-
require "zoom/profile/ag"
|
624
|
-
require "zoom/profile/find"
|
625
|
-
require "zoom/profile/grep"
|
626
|
-
require "zoom/profile/passwords"
|
data/lib/zoom/profile.rb
CHANGED
@@ -102,3 +102,10 @@ class Zoom::Profile < Hash
|
|
102
102
|
].join(" ").strip
|
103
103
|
end
|
104
104
|
end
|
105
|
+
|
106
|
+
require "zoom/profile/ack"
|
107
|
+
require "zoom/profile/ag"
|
108
|
+
require "zoom/profile/find"
|
109
|
+
require "zoom/profile/grep"
|
110
|
+
require "zoom/profile/passwords"
|
111
|
+
require "zoom/profile/pt"
|
data/lib/zoom/profile/ag.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "shellwords"
|
2
|
+
require "zoom/profile"
|
3
|
+
|
4
|
+
class Zoom::Profile::Pt < Zoom::Profile
|
5
|
+
def exe(args, pattern)
|
6
|
+
# Emulate ag/ack as much as possible
|
7
|
+
if (pattern.nil? || pattern.empty?)
|
8
|
+
system(
|
9
|
+
"#{self.to_s} #{args} #{self.append} | " \
|
10
|
+
"sed \"s|\\[K[:-]|\\[K\\n|\" | #{@pager}"
|
11
|
+
)
|
12
|
+
else
|
13
|
+
system(
|
14
|
+
"#{self.to_s} #{args} #{pattern.shellescape} " \
|
15
|
+
"#{self.append} | sed \"s|\\[K[:-]|\\[K\\n|\" | " \
|
16
|
+
"#{@pager}"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(
|
22
|
+
operator = nil,
|
23
|
+
flags = "--color -Se",
|
24
|
+
envprepend = "",
|
25
|
+
append = ""
|
26
|
+
)
|
27
|
+
super("pt", flags, envprepend, append)
|
28
|
+
@taggable = true
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-zoom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/zoom/profile/find.rb
|
90
90
|
- lib/zoom/profile/grep.rb
|
91
91
|
- lib/zoom/profile/passwords.rb
|
92
|
+
- lib/zoom/profile/pt.rb
|
92
93
|
homepage: http://mjwhitta.github.io/zoom
|
93
94
|
licenses:
|
94
95
|
- GPL-3.0
|
@@ -109,9 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
112
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.4.
|
113
|
+
rubygems_version: 2.4.5.1
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: Quickly open CLI search results in your favorite editor!
|
116
117
|
test_files: []
|
117
|
-
has_rdoc:
|