Class: Spty::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/spty/cli.rb

Class Method Summary collapse

Class Method Details

.call(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/spty/cli.rb', line 3

def self.call(args)
  command = args.shift

  begin
    klass = Object.const_get("Spty::Command::#{command.capitalize}Command")
    klass.(args, command)
  rescue NameError => _e
    if !command.nil?
      puts "Do not understand command: #{command}"
    end

    Spty::Command::HelpCommand.(args, command)
  end
end