Class: Flo::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/flo/cli.rb

Overview

Builds the command line parser and executes Flo::Runner using the commands supplied. In general you should be able to create a new instance and then pass in ARGV directly into #call.

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Cli

Creates a new CLI runner instance.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • runner_class (Class) — default: Runner

    Class of the runner object dependency



17
18
19
# File 'lib/flo/cli.rb', line 17

def initialize(opts={})
  @runner_class = opts[:runner_class] || Runner
end

Instance Method Details

#call(argv) ⇒ Object

Runs a command using args directly from ARGV.

Parameters:

  • argv (Array<String>)

    An array of strings. Typically you would pass in ARGV directly. The first value should be the name of the command



25
26
27
# File 'lib/flo/cli.rb', line 25

def call(argv)
  generate_commands.run(argv)
end