Class: Glossarist::CLI::ImportCommand
- Inherits:
-
Object
- Object
- Glossarist::CLI::ImportCommand
- Defined in:
- lib/glossarist/cli/import_command.rb
Instance Method Summary collapse
-
#initialize(files, options) ⇒ ImportCommand
constructor
A new instance of ImportCommand.
- #run ⇒ Object
Constructor Details
#initialize(files, options) ⇒ ImportCommand
Returns a new instance of ImportCommand.
6 7 8 9 |
# File 'lib/glossarist/cli/import_command.rb', line 6 def initialize(files, ) @files = files @options = end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/glossarist/cli/import_command.rb', line 11 def run importer = Sts::Importer.new( duplicate_strategy: @options[:on_duplicate]&.to_sym || :skip, ) result = if @options[:into] importer.import_into_existing(@files, @options[:into]) else importer.import_new(@files, **import_new_args) end print_summary(result) rescue ArgumentError => e warn "Error: #{e.}" exit 1 end |