Class: Zoom::Profile::Rg
Instance Attribute Summary
#exts, #files, #format_flags, #regex, #taggable
Instance Method Summary
collapse
#after, #before, #class_name, #exe, #flags, from_json, #grep_like_tags?, #name, #preprocess, profile_by_name, subclasses, #to_s, #tool
Constructor Details
#initialize(n = nil, t = nil, f = nil, b = nil, a = nil) ⇒ Rg
15
16
17
18
19
|
# File 'lib/zoom/profile/rg.rb', line 15
def initialize(n = nil, t = nil, f = nil, b = nil, a = nil)
f ||= "-PS"
t ||= "rg"
super(n, t, f, b, a)
end
|
Instance Method Details
2
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/zoom/profile/rg.rb', line 2
def grep_like_format_flags(all = false)
super
@format_flags = [
"--color never",
"-H",
"-n",
"--no-heading",
"--no-messages"
].join(" ")
@format_flags = "#{@format_flags} -uuu" if (all)
@taggable = true
end
|
#only_exts_and_files ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/zoom/profile/rg.rb', line 21
def only_exts_and_files
f = Array.new
@exts.each do |ext|
f.push("--type-add \"zoom:*.#{ext}\"")
end
@files.each do |file|
f.push("--type-add \"zoom:#{file}\"")
end
f.push("-t zoom") if (!@exts.empty? || !@files.empty?)
return f.join(" ")
end
|
#translate(from) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/zoom/profile/rg.rb', line 33
def translate(from)
to = Array.new
from.each do |flag, value|
case flag
when "all"
grep_like_format_flags(true)
when "follow"
to.push("--follow")
when "ignore"
value.each do |v|
to.push("--iglob=\"!#{v}\"")
end
when "word-regexp"
to.push("-w")
end
end
return to.join(" ")
end
|