oldnotes.js 914 B

12345678910111213141516171819202122232425262728293031
  1. const stripAnsi = require('strip-ansi')
  2. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  3. const normalizeCols = require('../util/normalize.js')
  4. module.exports.name = 'oldnotes'
  5. module.exports.description = 'List all iOS notes (from older unused database)'
  6. module.exports.func = function (program, base) {
  7. if (!program.backup) {
  8. console.log('use -b or --backup <id> to specify backup.')
  9. process.exit(1)
  10. }
  11. // Grab the backup
  12. var backup = iPhoneBackup.fromID(program.backup, base)
  13. backup.getOldNotes(program.dump)
  14. .then((items) => {
  15. program.formatter.format(items, {
  16. color: program.color,
  17. columns: {
  18. 'Modified': el => el.XFORMATTEDDATESTRING,
  19. 'ID': el => el.Z_PK,
  20. 'Title': el => (el.ZTITLE + '').substring(0, 128)
  21. }
  22. })
  23. })
  24. .catch((e) => {
  25. console.log('[!] Encountered an Error:', e)
  26. })
  27. }