Class: Zoom::Profile::Ack

Inherits:
Zoom::Profile show all
Defined in:
lib/zoom/profile/ack.rb

Instance Attribute Summary

Attributes inherited from Zoom::Profile

#immutable, #taggable

Instance Method Summary collapse

Methods inherited from Zoom::Profile

#append, cache_file, #flags, from_json, #info, #operator, #prepend, profile_by_name, #to_s

Constructor Details

#initialize(operator = nil, flags = "--smart-case", envprepend = "", append = "") ⇒ Ack

Returns a new instance of Ack.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/zoom/profile/ack.rb', line 23

def initialize(
    operator = nil,
    flags = "--smart-case",
    envprepend = "",
    append = ""
)
    # Special case because of debian
    operator = "ack"
    operator = "ack-grep" if (ScoobyDoo.where_are_you("ack-grep"))

    super(operator, flags, envprepend, append)
    @taggable = true
end

Instance Method Details

#colors ⇒ Object



5
6
7
# File 'lib/zoom/profile/ack.rb', line 5

def colors
    'ACK_COLOR_LINENO=white ACK_COLOR_MATCH="black on_white"'
end

#exe(args, pattern) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/zoom/profile/ack.rb', line 9

def exe(args, pattern)
    if (pattern.nil? || pattern.empty?)
        system(
            "#{self.to_s} --pager \"#{@pager}\" #{args} " \
            "#{self.append}"
        )
    else
        system(
            "#{self.to_s} --pager \"#{@pager}\" #{args} " \
            "#{pattern.shellescape} #{self.append}"
        )
    end
end