taskninja 1.1.0 → 1.1.2
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 +19 -11
- package/app.js +12 -10
- package/images/addNew.png +0 -0
- package/images/allFeatures.png +0 -0
- package/images/deleteMethod.png +0 -0
- package/images/doneTask.png +0 -0
- package/images/doneTask2.png +0 -0
- package/images/listAll.png +0 -0
- package/images/searchWith.png +0 -0
- package/images/sortBy.png +0 -0
- package/images/sort_.png +0 -0
- package/images/todo.json.png +0 -0
- package/images/undoMethod.png +0 -0
- package/images/updateWith.png +0 -0
- package/package.json +12 -1
- package/images/add.png +0 -0
- package/images/delete.png +0 -0
- package/images/delete2.png +0 -0
- package/images/done.png +0 -0
- package/images/done2.png +0 -0
- package/images/list.png +0 -0
- package/images/search.png +0 -0
- package/images/sort.png +0 -0
- package/images/sort2.png +0 -0
- package/images/undo.png +0 -0
- package/images/update.png +0 -0
package/README.md
CHANGED
|
@@ -347,36 +347,44 @@ tn so
|
|
|
347
347
|
|
|
348
348
|
## Screenshots / Demo
|
|
349
349
|
|
|
350
|
+
**All Features:**
|
|
351
|
+
|
|
352
|
+

|
|
353
|
+
|
|
350
354
|
**Adding a Task:**
|
|
351
355
|
|
|
352
|
-

|
|
353
357
|
|
|
354
358
|
**Listing Tasks:**
|
|
355
359
|
|
|
356
|
-

|
|
357
361
|
|
|
358
362
|
**Updating a Task:**
|
|
359
363
|
|
|
360
|
-

|
|
361
365
|
|
|
362
366
|
**Deleting a Task:**
|
|
363
367
|
|
|
364
|
-

|
|
368
|
+

|
|
366
369
|
|
|
367
370
|
**Restore Last-Deleted Task:**
|
|
368
371
|
|
|
369
|
-

|
|
370
373
|
|
|
371
374
|
**Search / Sort Tasks:**
|
|
372
375
|
|
|
373
|
-

|
|
377
|
+

|
|
378
|
+

|
|
376
379
|
|
|
377
380
|
**Mark as Done:**
|
|
378
381
|
|
|
379
|
-

|
|
383
|
+

|
|
384
|
+
|
|
385
|
+
**Tasks in `todos.json`:**
|
|
386
|
+
|
|
387
|
+

|
|
388
|
+
|
|
381
389
|
|
|
382
390
|
---
|
package/app.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - fs: For file system operations
|
|
11
11
|
* Author: Mohamed Bakr
|
|
12
12
|
* Date: January 2024
|
|
13
|
-
* Version: 1.1.
|
|
13
|
+
* Version: 1.1.2
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
// for using commands in terminal
|
|
@@ -48,7 +48,7 @@ const displayTasks = (tasks) => {
|
|
|
48
48
|
chalk.cyanBright('DueDate'),
|
|
49
49
|
chalk.cyanBright('Description')
|
|
50
50
|
],
|
|
51
|
-
colWidths: [4, 4, 30,
|
|
51
|
+
colWidths: [4, 4, 30, 15, 10, 12, 60]
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
tasks.forEach((task, index) => {
|
|
@@ -196,7 +196,7 @@ program
|
|
|
196
196
|
if (field === 'title') return task.title.toLowerCase().includes(searchTerm.toLowerCase());
|
|
197
197
|
if (field === 'description') return task.description.toLowerCase().includes(searchTerm.toLowerCase());
|
|
198
198
|
return task.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
199
|
-
|
|
199
|
+
task.description.toLowerCase().includes(searchTerm.toLowerCase());
|
|
200
200
|
});
|
|
201
201
|
|
|
202
202
|
if (founded.length === 0) {
|
|
@@ -246,7 +246,8 @@ program
|
|
|
246
246
|
]);
|
|
247
247
|
criteria = answer.criteria;
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
// normailze input `case-insensitive + separators`
|
|
250
|
+
criteria = criteria.toLowerCase().replace(/[-_]/g, '');
|
|
250
251
|
|
|
251
252
|
if (!['dueDate', 'priority', 'status'].includes(criteria)) {
|
|
252
253
|
console.log(chalk.red('Invalid sort criteria. Use --by with dueDate, priority, or status.'));
|
|
@@ -256,16 +257,16 @@ program
|
|
|
256
257
|
const sortedTasks = [...tasks];
|
|
257
258
|
|
|
258
259
|
switch (criteria) {
|
|
259
|
-
case '
|
|
260
|
+
case 'duedate':
|
|
260
261
|
sortedTasks.sort((a, b) => new Date(a.dueDate) - new Date(b.dueDate));
|
|
261
262
|
break;
|
|
262
|
-
case 'priority'
|
|
263
|
+
case 'priority':
|
|
263
264
|
const priorityOrder = { 'high': 1, 'medium': 2, 'low': 3 };
|
|
264
265
|
sortedTasks.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
|
|
265
266
|
break;
|
|
266
|
-
case 'status'
|
|
267
|
+
case 'status':
|
|
267
268
|
const statusOrder = { 'todo': 1, 'in-progress': 2, 'done': 3 };
|
|
268
|
-
sortedTasks.sort((a, b) => statusOrder[a.
|
|
269
|
+
sortedTasks.sort((a, b) => statusOrder[a.status] - statusOrder[b.status]);
|
|
269
270
|
break;
|
|
270
271
|
default:
|
|
271
272
|
console.log(chalk.red('Invalid sort criteria. Use dueDate, priority, or status.'));
|
|
@@ -380,10 +381,11 @@ program
|
|
|
380
381
|
default: false
|
|
381
382
|
},
|
|
382
383
|
{
|
|
383
|
-
type: "
|
|
384
|
+
type: "input",
|
|
384
385
|
name: 'description',
|
|
385
386
|
message: 'Enter the new description:',
|
|
386
|
-
when: answers => answers.changeDescription
|
|
387
|
+
when: answers => answers.changeDescription,
|
|
388
|
+
validate: input => input.trim() ? true : 'Description cannot be empty!'
|
|
387
389
|
}
|
|
388
390
|
]);
|
|
389
391
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/images/sort_.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taskninja",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "a simple CLI application with JS as a (To-Do Application)",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,17 @@
|
|
|
14
14
|
"taskninja": "./app.js",
|
|
15
15
|
"tn": "./app.js"
|
|
16
16
|
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/MoBMoCaffeine/taskninja--todo-CLI-app-.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"cli",
|
|
23
|
+
"todo",
|
|
24
|
+
"task-manager",
|
|
25
|
+
"javascript",
|
|
26
|
+
"node"
|
|
27
|
+
],
|
|
17
28
|
"author": "Moahmed Bakr",
|
|
18
29
|
"license": "ISC",
|
|
19
30
|
"dependencies": {
|
package/images/add.png
DELETED
|
Binary file
|
package/images/delete.png
DELETED
|
Binary file
|
package/images/delete2.png
DELETED
|
Binary file
|
package/images/done.png
DELETED
|
Binary file
|
package/images/done2.png
DELETED
|
Binary file
|
package/images/list.png
DELETED
|
Binary file
|
package/images/search.png
DELETED
|
Binary file
|
package/images/sort.png
DELETED
|
Binary file
|
package/images/sort2.png
DELETED
|
Binary file
|
package/images/undo.png
DELETED
|
Binary file
|
package/images/update.png
DELETED
|
Binary file
|