Class: VivlioStarter::CLI::SamovarCommands::IndexImportCommand

Inherits:
VsCommand
  • Object
show all
Defined in:
lib/vivlio_starter/cli/samovar/index_command.rb

Overview

index:import コマンド - 持ち運び用ファイルから用語集[g]・棄却語 を取り込む

Constant Summary

Constants included from OptionTokenNormalizer

OptionTokenNormalizer::BARE_VALUE_DEFAULTS

Instance Method Summary collapse

Methods included from OptionTokenNormalizer

#initialize, prepended

Instance Method Details

#callObject



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/vivlio_starter/cli/samovar/index_command.rb', line 230

def call
  return print_usage if options[:help]

  guard_failure = Guards.precheck(Guards::ProjectRootCheck.new)
  return guard_failure if guard_failure

  path = IndexCommands::IndexLibrary.resolve_path((args || []).first)
  Common.log_info("取り込み元: #{path}")
  result = IndexCommands::IndexLibrary.new.import!(path, prefer_import: options[:prefer_import])
  result ? 0 : 1
rescue SystemExit => e
  raise e
rescue StandardError => e
  Common.log_error("index:import 実行中にエラー: #{e.message}")
  1
end