Module: CommandHelper

Included in:
EasyImgUtils
Defined in:
lib/easyimg_utils.rb

Instance Method Summary collapse

Instance Method Details

#list(a = @commands) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/easyimg_utils.rb', line 31

def list(a=@commands)

  format_command = ->(s) do
    command, desc = s.split(/\s+#\s+/,2)
    " %s %s %s" % ['*'.blue, command, desc.to_s.light_black]
  end

  puts a.map(&format_command).join("\n")
  
end

#search(s) ⇒ Object



42
43
44
# File 'lib/easyimg_utils.rb', line 42

def search(s)
  list @commands.grep Regexp.new(s.to_s)
end