apps.js 1007 B

1234567891011121314151617181920212223242526272829303132
  1. module.exports.name = 'apps'
  2. module.exports.description = 'List all installed applications and container IDs.'
  3. // Specify this reporter requires a backup.
  4. // The second parameter to func() is now a backup instead of the path to one.
  5. module.exports.requiresBackup = true
  6. // Specify this reporter supports the promises API for allowing chaining of reports.
  7. module.exports.usesPromises = true
  8. module.exports.func = function (program, backup, resolve, reject) {
  9. // Fail if manifest does not exist
  10. if (!backup.manifest) return reject(new Error('Manifest does not exist in this version'))
  11. // Enumerate the apps in the backup
  12. var apps = []
  13. for (var key in backup.manifest.Applications) {
  14. var app = backup.manifest.Applications[key]
  15. apps.push({ bundleID: app.CFBundleIdentifier, path: app.Path })
  16. }
  17. var result = program.formatter.format(apps, {
  18. program: program,
  19. columns: {
  20. 'Bundle ID': el => el.bundleID,
  21. 'Bundle Path': el => el.path
  22. }
  23. })
  24. resolve(result)
  25. }