Class: FlowEngine::CLI::Commands::ValidateFlow

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

Instance Method Summary collapse

Instance Method Details

#call(flow_file:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/flowengine/cli/commands/validate_flow.rb', line 11

def call(flow_file:, **)
  definition = FlowLoader.load(flow_file)
  errors = validate_definition(definition)

  if errors.empty?
    print_success(definition)
  else
    print_errors(errors)
    exit 1
  end
rescue FlowEngine::CLI::Error => e
  warn "Error: #{e.message}"
  exit 1
rescue FlowEngine::Error => e
  warn "Definition error: #{e.message}"
  exit 1
end