Open twocoins-ca opened 1 year ago
Thanks for your post and how do we clean up the task lists or it must be store in our local files somewhere?
program
.command('clear')
.description('Clear tasks')
.option('-t, --tasks <tasks...>', 'The tasks to clear. If not specified, all tasks will be cleared.')
.action(clear)
clear.js
in commands folder.export function clear({tasks}) {
let todoList = conf.get('todo-list');
if (todoList) {
if (tasks) {
tasks.forEach(task => {
const index = todoList.indexOf(task);
if (index != -1) {
todoList.splice(index, 1);
} else {
console.log(chalk.red.bold(`Task ${task} not found`));
process.exit();
}
});
} else {
todoList = [];
}
conf.set('todo-list', todoList);
}
console.log(chalk.green.bold('Task has been cleared successfully!'));
}
Thanks for your post and how do we clean up the task lists or it must be store in our local files somewhere?