Module: CommandHelper

Included in:
EasyVideoUtils
Defined in:
lib/easyvideo_utils.rb

Instance Method Summary collapse

Instance Method Details

#list(a = @commands) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/easyvideo_utils.rb', line 16

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 {|x| format_command.call(x) }.join("\n")

end

#search(s) ⇒ Object



27
28
29
# File 'lib/easyvideo_utils.rb', line 27

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