-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
47 lines (40 loc) · 1.14 KB
/
index.ts
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Command } from "commander";
import { addTaskHandler } from "./commands/addTask";
import { deleteTaskHandler } from "./commands/deleteTask";
import { listTaskHandler } from "./commands/listTask";
import { updateTaskHandler } from "./commands/updateTask";
const program = new Command();
program
.name("taskmaster-cli")
.description("CLI to manage your tasks")
.version("0.8.0");
program
.command("addTask")
.description("Add a task")
.argument("<string>", "name of your task")
.action((str) => {
addTaskHandler(str);
});
program
.command("listTasks")
.description("List all tasks")
.action(() => {
listTaskHandler()
});
program
.command("updateTask")
.description("Update Task")
.argument("id","id to update")
.option("--completed <BOOLEAN>","Task Completion Status")
.action((id,options) => {
console.log("options.completed", options.completed);
updateTaskHandler(parseInt(id),options.completed)
});
program
.command("deleteTask")
.description("Delete a specific task")
.argument("id", "task to delete")
.action((id) => {
deleteTaskHandler(parseInt(id));
});
program.parse(process.argv);