Method: Command::CommandBase#execute

Defined in:
lib/commandbase.rb

#execute(argv) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/commandbase.rb', line 38

def execute(argv)
  @options.clear
  load_local_settings
  @opt.parse!(argv)
rescue OptionParser::InvalidOption => e
  error "不明なオプションです(#{e})"
  exit Narou::EXIT_ERROR_CODE
rescue OptionParser::InvalidArgument => e
  error "オプションの引数が正しくありません(#{e})"
  exit Narou::EXIT_ERROR_CODE
rescue OptionParser::MissingArgument => e
  error "オプションの引数が指定されていないか正しくありません(#{e})"
  exit Narou::EXIT_ERROR_CODE
end