diff --git a/commands/tm.js b/commands/tm.js index 2e3a33b..1be6f6d 100644 --- a/commands/tm.js +++ b/commands/tm.js @@ -1,5 +1,4 @@ const format = require('date-fns/format'); -const bplist = require('bplist-parser'); const { _get } = require('../lib/helpers'); const cmd = require('../lib/async-cmd'); @@ -15,11 +14,10 @@ const status = async () => { const latestbackup = async (options = {}) => { const dateFormat = _get(options, 'F', 'yyyy-MM-dd HH:mm:ss'); - const path = '/Library/Preferences/com.apple.TimeMachine.plist'; - const obj = await bplist.parseFile(path); - const arr = obj[0].Destinations[0].SnapshotDates; - const last = arr[arr.length - 1]; - return format(new Date(last), dateFormat); + const exec = + '/usr/libexec/PlistBuddy -c "Print Destinations:0:SnapshotDates" /Library/Preferences/com.apple.TimeMachine.plist | tail -n 2 | head -n 1'; + const result = await cmd(exec); + return format(new Date(result), dateFormat); }; module.exports = { status, latestbackup }; diff --git a/package-lock.json b/package-lock.json index 0ea34d4..9cd17b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "btt-helper", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1600,11 +1600,6 @@ "tweetnacl": "^0.14.3" } }, - "big-integer": { - "version": "1.6.44", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.44.tgz", - "integrity": "sha512-7MzElZPTyJ2fNvBkPxtFQ2fWIkVmuzw41+BZHSzpEq3ymB2MfeKp1+yXl/tS75xCx+WnyV+yb0kp+K1C3UNwmQ==" - }, "bluebird": { "version": "3.5.4", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.4.tgz", @@ -1652,14 +1647,6 @@ } } }, - "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "requires": { - "big-integer": "^1.6.44" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", diff --git a/package.json b/package.json index ac22227..4ec66bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "btt-helper", - "version": "1.2.0", + "version": "1.2.1", "description": "Helpers to improve your BetterTouchTool presets", "author": "Martín M.", "license": "MIT", @@ -17,7 +17,6 @@ "lint:fix": "eslint . --fix" }, "dependencies": { - "bplist-parser": "^0.2.0", "chalk": "^2.4.2", "cli-table": "^0.3.1", "commander": "^3.0.1",