lib/command/update.rb in narou-1.1.0.rc1 vs lib/command/update.rb in narou-1.1.0.rc2

- old
+ new

@@ -15,10 +15,11 @@ ・管理対象の小説を更新します。 更新したい小説のNコード、URL、タイトル、IDもしくは別名を指定して下さい。 IDは #{@opt.program_name} list を参照して下さい。 ・対象を指定しなかった場合、すべての小説の更新をチェックします。 ・一度に複数の小説を指定する場合は空白で区切って下さい。 + ・全て更新する場合、convert.no-openが設定されていなくても保存フォルダは開きません。 Example: narou update # 全て更新 narou update 0 1 2 4 narou update n9669bk 異世界迷宮で奴隷ハーレムを @@ -32,24 +33,25 @@ end def execute(argv) super update_target_list = argv.dup + no_open = false if update_target_list.empty? Database.instance.each do |id, _| update_target_list << id end + no_open = true end update_target_list.each_with_index do |target, i| display_message = nil data = Downloader.get_data_by_target(target) - title = data["title"] if !data - display_message = "#{target} は存在しません" + display_message = "#{target} は管理小説の中に存在しません" elsif Narou.novel_frozen?(target) if argv.length > 0 - display_message = "#{title} は凍結中です" + display_message = "#{data["title"]} は凍結中です" else next end end Helper.print_horizontal_rule if i > 0 @@ -58,13 +60,13 @@ next end is_updated = Downloader.start(target) if is_updated unless @options["no-convert"] - Convert.execute_and_rescue_exit([target]) + Convert.execute_and_rescue_exit([target, (no_open ? "--no-open" : "")]) end else - puts "#{title} に更新はありません" + puts "#{data["title"]} に更新はありません" end end rescue Interrupt puts "アップデートを中断しました" exit 1