Class: FlowEngine::CLI::Commands::Run

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/flowengine/cli/commands/run.rb

Instance Method Summary collapse

Instance Method Details

#call(flow_file:, **options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/flowengine/cli/commands/run.rb', line 16

def call(flow_file:, **options)
  engine = run_flow(flow_file)
  json_output = JSON.pretty_generate(build_result(flow_file, engine))

  display_success("Flow completed!")
  puts json_output

  write_output(options[:output], json_output) if options[:output]
rescue FlowEngine::CLI::Error => e
  display_error(e.message)
  exit 1
rescue FlowEngine::Error => e
  display_error("Engine error: #{e.message}")
  exit 1
end