Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcsunset/taskwarrior-lib
A Node.js library for interacting with taskwarrior
https://github.com/dcsunset/taskwarrior-lib
library nodejs taskwarrior typescript
Last synced: 2 months ago
JSON representation
A Node.js library for interacting with taskwarrior
- Host: GitHub
- URL: https://github.com/dcsunset/taskwarrior-lib
- Owner: DCsunset
- License: mit
- Created: 2020-06-16T08:12:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-09T03:00:42.000Z (about 2 years ago)
- Last Synced: 2024-10-11T22:44:49.239Z (3 months ago)
- Topics: library, nodejs, taskwarrior, typescript
- Language: TypeScript
- Homepage:
- Size: 33.2 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# taskwarrior-lib
[![npm version](https://badgen.net/npm/v/taskwarrior-lib)](https://www.npmjs.com/package/taskwarrior-lib)
[![license](https://badgen.net/github/license/dcsunset/taskwarrior-lib)](https://github.com/DCsunset/taskwarrior-lib)A Node.js library for interacting with taskwarrior
## Installation
```
npm install taskwarrior-lib
```## Requirements
* [Taskwarrior](https://taskwarrior.org/) 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:
```js
import { TaskwarriorLib } from 'taskwarrior-lib';
const taskwarrior = new TaskwarriorLib();
```Or you can specify the taskwarrior config path and data path:
```js
const taskwarrior = new TaskwarriorLib(
'~/.taskrc',
'~/.task'
);
```To add tasks:
```js
let msg = taskwarrior.update([
{
description: 'test 1',
priority: 'L'
},
{
description: 'test 2',
priority: 'M'
}
]);
console.log(msg);
```To load tasks:
```js
const tasks = taskwarrior.load('status:pending');
console.log(tasks);
```To modify tasks:
```js
const task = tasks[tasks.length - 1];
task.due = 'now+1d';
task.priority = 'H';
let msg = taskwarrior.update([task]);
console.log(msg);
```To delete tasks:
```js
taskwarrior.del(tasks.slice(tasks.length - 1));
```## License
MIT License