Package Exports
- tasktree-cli
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tasktree-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Simple terminal task tree - helps you keep track of your tasks in a tree structure.

Install
Yarn
yarn add tasktree-cli
NPM
npm install tasktree-cli
Usage
const { TaskTree } = require('tasktree-cli');
const tree = TaskTree.tree();
// start task tree log update in terminal
tree.start();
// create tasks
const task1 = tree.add('{underline Task {bold #1}}');
const task2 = tree.add('Task {bold #2}');
const task3 = task2.add('Subtask...');
const tpl = ':bar :rate/bps {cyan.bold :percent} :etas';
// create progress bars
const bars = [task3.bar(tpl), task3.bar(tpl), task3.bar(tpl)];
// ... whatever
let once = false;
const promises = [50, 75, 200].map((ms, i) => {
return new Promise((resolve) => {
const handle = setInterval(() => {
if (once) {
if (bars[i].percent >= 50) {
bars[i].skip();
} else {
bars[i].fail();
}
} else {
once = bars[i].tick(Math.random() * 10).isCompleted;
}
if (once) {
clearInterval(handle);
resolve();
}
}, ms);
});
});
Promise.all(promises).then(() => {
// skip task
task3.skip('Subtask skipped');
// log info message in Task #2, complete task
task2.log('Informational message').complete();
// log warning and error in Task #1, fail it
task1.warn('Warning message').error(new Error('Something bad happened'), true);
// stop task tree log update
tree.stop();
});
TaskTree uses chalk to style text and supports formatting as a tagged template literal.
const task = new Task('{underline.cyan.bold Awesome task}');
API
Read the API documentation for more information.