Class: UnimatrixCLI::CLI

Inherits:
Command show all
Defined in:
lib/unimatrix_cli/cli.rb

Instance Method Summary collapse

Methods inherited from Command

available_commands, descendants, #initialize, #read_file, #validate, #validate_collection, #write

Methods included from UnimatrixParser

included

Constructor Details

This class inherits a constructor from UnimatrixCLI::Command

Instance Method Details

#parse_commandObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/unimatrix_cli/cli.rb', line 12

def parse_command
  command = ARGV.shift

  if command == "login" || command == "logout"
    sub_command = "#{ command.capitalize }Command"
    "#{ sub_command }"
  else
    unimatrix_app, resource, sub_command = command.split( '::' ).
      map { | word | camelize( word ) }
    sub_command = "#{ sub_command }Command"
    "#{ unimatrix_app }::#{ resource }::#{ sub_command }"
  end
end