taskwarrior-lib

v0.4.1
A Node.js library for interacting with taskwarrior
taskwarrior node.js typescript library

taskwarrior-lib

npm version license

A Node.js library for interacting with taskwarrior

Installation

npm install taskwarrior-lib

Requirements

  • Taskwarrior v2.4.5 or above (which supports import command)

Usage

The following examples are using ES modules, and CommonJS modules are also supported.

To import the library:

import { TaskwarriorLib } from 'taskwarrior-lib';
const taskwarrior = new TaskwarriorLib();

Or you can specify the taskwarrior config path and data path:

const taskwarrior = new TaskwarriorLib(
    '~/.taskrc',
    '~/.task'
);

To add tasks:

let msg = taskwarrior.update([
    {
        description: 'test 1',
        priority: 'L'
    },
    {
        description: 'test 2',
        priority: 'M'
    }
]);
console.log(msg);

To load tasks:

const tasks = taskwarrior.load('status:pending');
console.log(tasks);

To modify tasks:

const task = tasks[tasks.length - 1];
task.due = 'now+1d';
task.priority = 'H';
let msg = taskwarrior.update([task]);
console.log(msg);

To delete tasks:

taskwarrior.del(tasks.slice(tasks.length - 1));

License

MIT License

Metadata

  • MIT
  • Whatever
  • DCsunset
  • released 7/14/2020

Downloads

Maintainers