Method: ListTool::App::Commands.process

Defined in:
lib/list_tool/app/commands.rb

.process(argv, lister) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/list_tool/app/commands.rb', line 20

def self.process argv, lister
  argv.is_a?(Array) || raise(ArgumentError, "expected first paramenter to be an Array, #{argv.class} given")
  argv << 'h' if argv.empty?
  param = argv.shift

  begin
    COMMANDS.each do |cmd|
      if cmd.match? param
        cmd.execute cmd.parse(argv), lister
        break
      end
    end
  end

end