Class: Devkitkat::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/devkitkat/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommand

Returns a new instance of Command.



7
8
9
10
11
12
13
14
15
# File 'lib/devkitkat/command.rb', line 7

def initialize
  @options = {}
  option_parser.parse!

  @script, @target, *@args = ARGV

  show_help if script == 'help'
  show_version if script == 'version'
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/devkitkat/command.rb', line 5

def args
  @args
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/devkitkat/command.rb', line 5

def options
  @options
end

#scriptObject (readonly)

Returns the value of attribute script.



5
6
7
# File 'lib/devkitkat/command.rb', line 5

def script
  @script
end

#targetObject (readonly)

Returns the value of attribute target.



5
6
7
# File 'lib/devkitkat/command.rb', line 5

def target
  @target
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/devkitkat/command.rb', line 25

def debug?
  options[:debug]
end

#interactive?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/devkitkat/command.rb', line 17

def interactive?
  options[:interactive]
end

#kit_rootObject



33
34
35
# File 'lib/devkitkat/command.rb', line 33

def kit_root
  options[:root_path] || Dir.pwd
end

#nameObject



37
38
39
# File 'lib/devkitkat/command.rb', line 37

def name
  script.tr('-', '_')
end

#quiet?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/devkitkat/command.rb', line 29

def quiet?
  options[:quiet]
end

#variablesObject



21
22
23
# File 'lib/devkitkat/command.rb', line 21

def variables
  options[:variables]
end