Last active
September 1, 2016 07:48
-
-
Save projectivemotion/9614c250b6c2902e35e677f015ac500a to your computer and use it in GitHub Desktop.
Example Script to obtain taskwarrior information using node js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Amado Martinez <amadomartinez.mx> | |
* | |
* Example Typescript / Javascript to retrieve taskwarrior data | |
*/ | |
var execSync = require("child_process").execSync; | |
var getIds = (filter) => { | |
let ids = execSync("task " + filter + " _id").toString().split("\n"); | |
ids.pop(); // remove empty line | |
return ids; | |
}; | |
var getProperty = (prop, id) => { | |
return execSync("task _get " + id + "." + prop).toString().trim(); | |
}; | |
//console.log(getIds('+ACTIVE')); | |
var active = getIds('+ACTIVE'); | |
var descriptions = active.map((id) => { | |
return getProperty("description", id); | |
}); | |
console.log(descriptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Amado Martinez <amadomartinez.mx> | |
* | |
* Example Typescript / Javascript to retrieve taskwarrior data | |
*/ | |
var execSync = require("child_process").execSync; | |
var getIds = (filter) => { | |
let ids = execSync("task " + filter + " _id").toString().split("\n"); | |
ids.pop(); // remove empty line | |
return ids; | |
} ; | |
var getProperty = (prop, id) => { | |
return execSync("task _get " + id + "."+prop).toString().trim(); | |
}; | |
//console.log(getIds('+ACTIVE')); | |
var active=getIds('+ACTIVE'); | |
var descriptions = active.map((id) => { | |
return getProperty("description", id); | |
}); | |
console.log(descriptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment