Class: Glossarist::CLI::ExportCommand
- Inherits:
-
Object
- Object
- Glossarist::CLI::ExportCommand
- Defined in:
- lib/glossarist/cli/export_command.rb
Constant Summary collapse
- EXTENSIONS =
{ "json" => "json", **GcrPackage::COMPILED_EXTENSIONS, }.freeze
Instance Method Summary collapse
-
#initialize(path, options) ⇒ ExportCommand
constructor
A new instance of ExportCommand.
- #run ⇒ Object
Constructor Details
#initialize(path, options) ⇒ ExportCommand
Returns a new instance of ExportCommand.
11 12 13 14 |
# File 'lib/glossarist/cli/export_command.rb', line 11 def initialize(path, ) @path = path @options = end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/glossarist/cli/export_command.rb', line 16 def run format = @options[:format] output_dir = File.(@options[:output]) FileUtils.mkdir_p(output_dir) concepts = load_concepts name = resolve_shortname case format when "json" then export_json(concepts, output_dir) when "jsonld" then export_jsonld(concepts, name, output_dir) when "turtle" then export_turtle(concepts, name, output_dir) when "tbx" then export_tbx(concepts, name, output_dir) when "jsonl" then export_jsonl(concepts, name, output_dir) end rescue ArgumentError => e warn "Error: #{e.}" exit 1 end |