-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·32 lines (27 loc) · 965 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /usr/bin/env node
const { program } = require("commander");
const list = require("./commands/list");
const add = require("./commands/add");
const updateDoneStatus = require("./commands/updateDoneStatus");
const removeTasks = require("./commands/remove");
program.command("list").description("List all the TODO tasks").action(list);
program.command("add <task>").description("Add a new todo task").action(add);
program
.command("rm")
.description("Remove the set of tasks")
.requiredOption("-t --tasks <tasks...>", "The specified task to be removed")
.action((options) => {
removeTasks(options.tasks);
});
program
.command("mark-done")
.description("Mark Task to be done")
.option(
"-t --tasks <tasks...>",
"The tasks to mark done. If not specified, all tasks will be marked done.",
)
.option("-u, --undone", "Revert the task status")
.action((options) => {
updateDoneStatus(options);
});
program.parse(process.argv);