Class: Inquirex::TTY::Commands::Export
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Inquirex::TTY::Commands::Export
- Defined in:
- lib/inquirex/tty/commands/export.rb
Overview
Exports a flow definition as JSON or YAML (stdout or file).
Examples:
inquirex export examples/08_tax_preparer.rb # JSON to stdout
inquirex export examples/08_tax_preparer.rb -f yml # YAML to stdout
inquirex export examples/08_tax_preparer.rb -o . # write 08_tax_preparer.json to cwd
inquirex export examples/08_tax_preparer.rb -f yml -o . # write 08_tax_preparer.yml to cwd
inquirex export examples/08_tax_preparer.rb -o out.json # write to out.json
Constant Summary collapse
- LONG_DESCRIPTION =
"Export a flow definition as JSON or YAML.\n\n" \ "Example:\n inquirex export examples/08_tax_preparer.rb -f yml -o ."
- SHORT_DESCRIPTION =
"Export a flow definition as JSON or YAML ."
Instance Method Summary collapse
Instance Method Details
#call(flow_file:, **options) ⇒ void
This method returns an undefined value.
41 42 43 44 45 46 47 48 49 |
# File 'lib/inquirex/tty/commands/export.rb', line 41 def call(flow_file:, **) definition = FlowLoader.load(flow_file) format = normalize_format([:format]) content = serialize(definition, format) write(content, flow_file, [:output], extension_for(format)) rescue Inquirex::TTY::Error => e warn "Error: #{e.}" exit 1 end |