Class: Vivlio::Starter::CLI::SamovarCommands::PdfReadCommand

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/vivlio/starter/cli/samovar/pdf_command.rb

Overview

pdf:read コマンドの Samovar 実装(Public コマンド)

Instance Method Summary collapse

Instance Method Details

#callObject



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/vivlio/starter/cli/samovar/pdf_command.rb', line 131

def call
  if options[:help] || target.to_s.strip.empty?
    print_usage
    return 0
  end

  pdf_reader.call
  0
rescue Commands::PdfReadCommand::InvalidInputError => e
  Common.log_error("[pdf:read] #{e.message}")
  1
rescue Commands::PdfReadCommand::MissingPdfError => e
  Common.log_error("[pdf:read] #{e.message}")
  1
rescue StandardError => e
  Common.log_error("[pdf:read] 実行中にエラー: #{e.message}")
  Common.log_error(e.backtrace.first(5).join("\n")) if ENV['VERBOSE']
  1
end