Class: VivlioStarter::CLI::SamovarCommands::IndexPlanCommand

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

Overview

index:plan コマンド - 索引の下見(読み取り専用)

index:auto --dry-run にしないのは、auto が「全自動でやる」と読める コマンドで、オプション 1 つで「実は確認用」に変わると名前の意味が ぶれるため(index-term-selection-spec.md §6.1)。

Constant Summary

Constants included from OptionTokenNormalizer

OptionTokenNormalizer::BARE_VALUE_DEFAULTS

Instance Method Summary collapse

Methods included from OptionTokenNormalizer

#initialize, prepended

Instance Method Details

#callObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/vivlio_starter/cli/samovar/index_command.rb', line 88

def call
  return print_usage if options[:help]

  guard_failure = Guards.precheck(
    Guards::ProjectRootCheck.new,
    Guards::CatalogFileCheck.new,
    Guards::RelaxedCheck.new(Guards::CatalogEntriesCheck.new),
    Guards::ContentsDirCheck.new
  )
  return guard_failure if guard_failure

  UnifiedIndexManager.new.plan!(IndexCommands.resolve_chapters(files || []))
  0
rescue SystemExit => e
  raise e
rescue StandardError => e
  Common.log_error("index:plan 実行中にエラー: #{e.message}")
  Common.log_error(e.backtrace.first(5).join("\n")) if ENV['VERBOSE']
  1
end