Method: Fuelcell.start

Defined in:
lib/fuelcell.rb

.start(args = [], settings = {}) { ... } ⇒ Int

Entry point for executing a command which was defined through the the fuelcell dsl. The executable command should return an exit code, used to exit the program.

Parameters:

  • args (Array) (defaults to: [])

    command line args to be processed

  • settings (Hash) (defaults to: {})

    allows for overriding parts of fuelcell

Yields:

  • optional block, will instance_eval on the root command

Returns:

  • (Int)


99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/fuelcell.rb', line 99

def start(args = [], settings = {}, &block)
  cli  = settings[:cli] || create_cli(settings)
  root = cli.root

  make_cli_available_for_definitions(cli)

  # expose the command dsl
  root.instance_eval(&block) if block_given?
  context = cli.parse(args)

  remove_cli_availability
  code = cli.execute(context)
  cli.handle_exit code
end