@umarfarooq57/tasky 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -0,0 +1,9 @@
1
+ # 📝 Tasky CLI
2
+
3
+ A sleek, fast, and colorful command-line interface (CLI) task manager built with Node.js. Effortlessly manage your daily tasks directly from your terminal.
4
+
5
+ ## ✨ Features
6
+
7
+ - **Blazing Fast**: Manage tasks instantly without leaving your terminal.
8
+ - **Colorful Output**: Beautiful, clear interface with color-coded feedback powered by `chalk`.
9
+ - **Local Storage**: Your data is saved locally on your machine, keeping it completely private.
package/bin/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { program } from "commander";
4
- import { addTask, editTask, listTasks } from "../src/commands.js";
4
+ import { addTask, deleteTask, editTask, listTasks } from "../src/commands.js";
5
5
 
6
6
  program
7
7
  .name("tasky")
@@ -33,5 +33,14 @@ program
33
33
  editTask(id, newDesc);
34
34
  });
35
35
 
36
+ // command to delete a task
37
+ program
38
+ .command("delete")
39
+ .description("Delete a task")
40
+ .argument("<id>", "The task id")
41
+ .action((id) => {
42
+ deleteTask(id);
43
+ });
44
+
36
45
  // parse the arguments passed by user
37
46
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umarfarooq57/tasky",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "A simple CLI tool to manage tasks",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
package/src/commands.js CHANGED
@@ -1,16 +1,21 @@
1
+ import chalk from "chalk";
1
2
  import { readTasks, saveTasks } from "./storage.js";
2
3
 
3
4
  export const addTask = (taskDescription) => {
4
5
  const tasks = readTasks();
5
6
  tasks.push({ id: tasks.length + 1, task: taskDescription, done: false });
6
7
  saveTasks(tasks);
7
- console.log(`Task added successfully: "${taskDescription}"`);
8
+ console.log(chalk.green(`Task added successfully: "${taskDescription}"`));
8
9
  };
9
10
 
10
11
  export const listTasks = () => {
11
12
  const tasks = readTasks();
12
13
  if (tasks.length === 0) {
13
- console.log('No tasks found. Type `tasky add "your task"` to create one!');
14
+ console.log(
15
+ chalk.red.bold(
16
+ 'No tasks found. Type `tasky add "your task"` to create one!',
17
+ ),
18
+ );
14
19
  return;
15
20
  }
16
21
  console.log("\nYour Task List:");
@@ -24,10 +29,26 @@ export const editTask = (id, newDesc) => {
24
29
  let tasks = readTasks();
25
30
  const taskToEdit = tasks.find((t) => t.id == id);
26
31
  if (!taskToEdit) {
27
- console.log(`Task with id:${id} does not exist`);
32
+ console.log(chalk.red(`Task with id:${id} does not exist`));
28
33
  return;
29
34
  }
30
35
  taskToEdit.task = newDesc;
31
- saveTasks(tasks)
32
- console.log(`Task with id:${id} is edited.`)
36
+ saveTasks(tasks);
37
+ console.log(
38
+ `Task with id:${chalk.blue.underline(id)} was successfully edited!`,
39
+ );
40
+ };
41
+
42
+ export const deleteTask = (id) => {
43
+ const tasks = readTasks();
44
+ const taskToDelete = tasks.find((t) => t.id == id);
45
+ if (!taskToDelete) {
46
+ console.log(`Task with id:${id} does not exist`);
47
+ return;
48
+ }
49
+ const updatedTasks = tasks.filter((t) => t.id != id);
50
+ saveTasks(updatedTasks);
51
+ console.log(
52
+ `Task with id:${chalk.blue.underline(id)} was successfully deleted!`,
53
+ );
33
54
  };
@@ -1,12 +1,12 @@
1
1
  [
2
2
  {
3
3
  "id": 1,
4
- "task": "Create LMS project",
4
+ "task": "Task 1",
5
5
  "done": false
6
6
  },
7
7
  {
8
8
  "id": 2,
9
- "task": "Create custom Git",
9
+ "task": "Task 2",
10
10
  "done": true
11
11
  }
12
12
  ]
Binary file