Class: CLIForge::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/cli_forge/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Runner

Returns a new instance of Runner.



3
4
5
# File 'lib/cli_forge/runner.rb', line 3

def initialize(config)
  @config = config
end

Instance Method Details

#start(arguments) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cli_forge/runner.rb', line 7

def start(arguments)
  arguments    = filter_arguments(arguments.dup)
  command_name = pop_command(arguments) || @config.default_command
  command_set  = CLIForge::CommandSet.new(@config)

  unless command = command_set[command_name]
    # TODO: Output!
    command = command_set[@config.default_command]
  end

  # TODO: Output!
  return 1 unless command

  command.call(arguments)
end