Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV] v1.2.1 #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions commands/tm.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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 };
15 changes: 1 addition & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down