Class: Inquirex::TTY::Commands::Run
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Inquirex::TTY::Commands::Run
- Defined in:
- lib/inquirex/tty/commands/run.rb
Overview
Runs a flow definition interactively via TTY prompts and writes the collected answers (plus metadata) as JSON to stderr or a file.
Instance Method Summary collapse
Instance Method Details
#call(flow_file:, **options) ⇒ void
This method returns an undefined value.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/inquirex/tty/commands/run.rb', line 17 def call(flow_file:, **) engine = run_flow(flow_file) json = JSON.pretty_generate(build_result(flow_file, engine)) if [:output] File.write([:output], json) puts "\nResults saved to #{[:output]}" else $stderr.puts json # rubocop:disable Style/StderrPuts end rescue Inquirex::TTY::Error => e error(e.) exit 1 rescue Inquirex::Errors::Error => e error("Engine error: #{e.}") exit 1 end |