taskwarrior-lib-bigbuffer
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

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

Package Sidebar

Install

npm i taskwarrior-lib-bigbuffer

Weekly Downloads

2

Version

0.4.2

License

MIT

Unpacked Size

9.97 kB

Total Files

6

Last publish

Collaborators

  • volodymyrss