Class: VivlioStarter::CLI::SamovarCommands::RenameCommand

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

Overview

rename コマンドの Samovar 実装

Direct Known Subclasses

RenumberCommand

Constant Summary

Constants included from OptionTokenNormalizer

OptionTokenNormalizer::BARE_VALUE_DEFAULTS

Instance Method Summary collapse

Methods included from OptionTokenNormalizer

#initialize, prepended

Instance Method Details

#callObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vivlio_starter/cli/samovar/rename_command.rb', line 42

def call
  return print_usage if options[:help]

  # 前提条件の検証(ProjectRoot ◎ / CatalogFile ◎ / ContentsDir ◎)
  # RenumberCommand も本クラスを継承するため同じ Guard が適用される
  guard_failure = Guards.precheck(
    Guards::ProjectRootCheck.new,
    Guards::CatalogFileCheck.new,
    Guards::ContentsDirCheck.new
  )
  return guard_failure if guard_failure

  ensure_argument_count!
  executor.call(*arguments.first(2))
  0
rescue SystemExit => e
  raise e
rescue StandardError => e
  VivlioStarter::CLI::Common.log_error("rename コマンド実行中にエラー: #{e.message}")
  1
end