Class: Pario::Cli

Inherits:
Object
  • Object
show all
Includes:
FileUtils
Defined in:
lib/pario/cli.rb

Constant Summary collapse

Directories =
%w{game lib media config}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, stdin) ⇒ Cli

Returns a new instance of Cli.



14
15
16
17
# File 'lib/pario/cli.rb', line 14

def initialize(arguments, stdin)
  @command = arguments[0]
  @arguments = arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



12
13
14
# File 'lib/pario/cli.rb', line 12

def arguments
  @arguments
end

#commandObject (readonly)

Returns the value of attribute command.



12
13
14
# File 'lib/pario/cli.rb', line 12

def command
  @command
end

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/pario/cli.rb', line 12

def options
  @options
end

Instance Method Details

#runObject

Parse options, check arguments, then process the command



20
21
22
23
24
25
26
27
# File 'lib/pario/cli.rb', line 20

def run  
  if valid_pario_command?   
    @command = arguments.delete_at(0)
    process_command 
  else
    puts "Command not recognized."
  end
end