lib/command/update.rb in narou-1.7.2 vs lib/command/update.rb in narou-2.0.0

- old
+ new

@@ -40,10 +40,11 @@ } end def execute(argv) super + mistook_count = 0 update_target_list = argv.dup no_open = false if update_target_list.empty? Database.instance.each_key do |id| update_target_list << id @@ -64,10 +65,11 @@ end end Helper.print_horizontal_rule if i > 0 if display_message puts display_message + mistook_count += 1 next end result = Downloader.start(target) case result.status when :ok @@ -77,17 +79,20 @@ convert_argv << "--no-open" if no_open Convert.execute!(convert_argv) end when :failed puts "ID:#{data["id"]} #{data["title"]} の更新は失敗しました" + mistook_count += 1 when :canceled puts "ID:#{data["id"]} #{data["title"]} の更新はキャンセルされました" + mistook_count += 1 when :none puts "#{data["title"]} に更新はありません" end end + exit mistook_count if mistook_count > 0 rescue Interrupt puts "アップデートを中断しました" - exit 1 + exit Narou::EXIT_ERROR_CODE end end end