blob: b50367aa16074f2d1612c2a29ad8d143c00a7a69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
var libaugeas = require('../build/Release/libaugeas');
var aug = libaugeas.createAugeas();
console.log('Before:');
aug.match('/files/etc/hosts/1/alias').forEach(function(p){
console.log(p + ' = ' + aug.get(p));
});
aug.defnode('newalias',
'/files/etc/hosts/1/alias[last()+1]',
'myhost', // may be omitted (= empty string)
function(created) {
if (created) {
console.log('New node created:');
console.log(aug.match('$newalias')[0]);
} else {
console.log('No new node created');
}
});
console.log('After:');
aug.match('/files/etc/hosts/1/alias').forEach(function(p){
console.log(p + ' = ' + aug.get(p));
});
|