osx-defaults
Version:
Access to OS X defaults program via simple API.
41 lines (35 loc) • 951 B
JavaScript
;
const defaults = require('../');
console.log('------------------ Rename Async ------------------');
console.log(
'original fooColorVariant',
defaults.read({
isGlobalDomain: true,
key: 'fooColorVariant'
})
);
defaults.rename({
isGlobalDomain: true,
key: 'fooColorVariant',
new_key: 'barColorVariant'
}, function(error, status) {
if (error) throw error;
if (status) {
console.log('Renamed');
console.log(
'renamed fooColorVariant -> barColorVariant',
defaults.read({
isGlobalDomain: true,
key: 'barColorVariant'
})
);
defaults.rename({
isGlobalDomain: true,
key: 'barColorVariant',
new_key: 'fooColorVariant'
});
} else {
console.log('Error occurred');
}
});
console.log('------------------ Rename Async ------------------');