Class: Ukiryu::CliCommands::RunFileCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Ukiryu::CliCommands::RunFileCommand
- Includes:
- ResponseFormatter
- Defined in:
- lib/ukiryu/cli_commands/run_file_command.rb
Overview
Execute a Ukiryu Structured Execution Request from a YAML file
Constant Summary
Constants included from ResponseFormatter
Ukiryu::CliCommands::ResponseFormatter::OUTPUT_FORMATS
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#run(request_file) ⇒ Object
Execute the command.
Methods included from ResponseFormatter
#output_response, #say_dry_run
Methods inherited from BaseCommand
#apply_cli_options_to_config, #default_register_path, #initialize, #setup_register, #stringify_keys
Constructor Details
This class inherits a constructor from Ukiryu::CliCommands::BaseCommand
Instance Method Details
#run(request_file) ⇒ Object
Execute the command
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ukiryu/cli_commands/run_file_command.rb', line 14 def run(request_file) setup_register # Output debug: Ukiryu CLI Options if config.debug logger = Ukiryu::Logger.new = { format: config.format, debug: config.debug, dry_run: config.dry_run, output: config.output, register: config.register, request_file: request_file } logger.() end # Get format from Config (priority: CLI > ENV > programmatic > default) format = config.format.to_sym error! "Invalid format: #{format}. Must be one of: #{OUTPUT_FORMATS.join(', ')}" unless OUTPUT_FORMATS.include?(format) # Load execution request request = load_execution_request(request_file) if config.dry_run # Show dry run output say_dry_run(request) return end # Execute the request response = execute_request(request) # Output response output_file = config.output output_response(response, format, output_file, config) # Don't exit here - let Thor handle the result end |