Method: FuzzyNotes::Notes#edit
- Defined in:
- lib/fuzzy_notes/notes.rb
#edit ⇒ Object
edit all matching notes in EDITOR
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/fuzzy_notes/notes.rb', line 69 def edit notes_to_edit = \ unless encrypted_notes.empty? print_notes(:encrypted => true) decrypted_tempfiles = @cipher.decrypt_to_tempfiles(encrypted_notes) successfully_decrypted_files = decrypted_tempfiles.compact plaintext_notes + successfully_decrypted_files else plaintext_notes end # edit decrypted files unless notes_to_edit.empty? system("#{@editor} #{bashify_note_paths(notes_to_edit)}") end # reencrypt decrypted notes unless encrypted_notes.empty? || successfully_decrypted_files.empty? log.info "#{CREATE_COLOR} re-encrypting edited notes:" tempfiles_notes = decrypted_tempfiles.zip(encrypted_notes) log.indent do tempfiles_notes.each do |(tmpfile, note_path)| log.info "#{PATH_COLOR} #{note_path}" if note_path end end log.indent { @cipher.encrypt_from_tempfiles(tempfiles_notes) } end end |