lib/rbnotes/commands/update.rb in rbnotes-0.3.1 vs lib/rbnotes/commands/update.rb in rbnotes-0.4.0

- old
+ new

@@ -42,19 +42,19 @@ rescue Textrepo::MissingTimestampError => _ raise Rbnotes::MissingTimestampError, target_stamp end tmpfile = run_with_tmpfile(editor, target_stamp.to_s, text) - text = File.readlines(tmpfile) + text = File.readlines(tmpfile, :chomp => true) unless text.empty? newstamp = nil begin newstamp = repo.update(target_stamp, text) rescue StandardError => e puts e.message else - puts "Update the note [%s -> %s]" % [target_stamp, newstamp] + puts "Update the note [%s -> %s]" % [target_stamp, newstamp] unless target_stamp == newstamp ensure # Don't forget to remove the temporary file. File.delete(tmpfile) end else