taskninja 1.1.1 → 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 CHANGED
@@ -347,36 +347,44 @@ tn so
347
347
 
348
348
  ## Screenshots / Demo
349
349
 
350
+ **All Features:**
351
+
352
+ ![All Features](images/allFeatures.png "all commands")
353
+
350
354
  **Adding a Task:**
351
355
 
352
- ![Add Task](images/add.png "Adding a Task in TaskNinja CLI")
356
+ ![Add Task](images/addNew.png "Adding a Task in TaskNinja CLI")
353
357
 
354
358
  **Listing Tasks:**
355
359
 
356
- ![List Tasks](images/list.png "Listing Tasks in TaskNinja CLI")
360
+ ![List Tasks](images/listAll.png "Listing Tasks in TaskNinja CLI")
357
361
 
358
362
  **Updating a Task:**
359
363
 
360
- ![Update Task](images/update.png "Updating a Task")
364
+ ![Update Task](images/updateWith.png "Updating a Task")
361
365
 
362
366
  **Deleting a Task:**
363
367
 
364
- ![Delete Task](images/delete.png "Deleting a Task")
365
- ![Delete Task](images/delete2.png "Deleting a Task")
368
+ ![Delete Task](images/deleteMethod.png "Deleting a Task")
366
369
 
367
370
  **Restore Last-Deleted Task:**
368
371
 
369
- ![Undo](images/undo.png "Restore Last-deleted task")
372
+ ![Undo](images/undoMethod.png "Restore Last-deleted task")
370
373
 
371
374
  **Search / Sort Tasks:**
372
375
 
373
- ![Search Tasks](images/search.png "Searching Tasks")
374
- ![Sort Tasks](images/sort.png "Sorting Tasks")
375
- ![Sort Tasks-2](images/sort2.png "Sorting Tasks")
376
+ ![Search Tasks](images/searchWith.png "Searching Tasks")
377
+ ![Sort Tasks](images/sort_.png "Sorting Tasks")
378
+ ![Sort Tasks-2](images/sortBy.png "Sorting Tasks")
376
379
 
377
380
  **Mark as Done:**
378
381
 
379
- ![Mark Task As Done](images/done.png "Mark as Done In one step")
380
- ![Mark Task As Done](images/done2.png "Mark as Done In one step")
382
+ ![Mark Task As Done](images/doneTask.png "Mark as Done In one step")
383
+ ![Mark Task As Done](images/doneTask2.png "Mark as Done In one step")
384
+
385
+ **Tasks in `todos.json`:**
386
+
387
+ ![todos.json](images/todo.json.png "shape of tasks")
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.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, 12, 10, 12, 60]
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
- task.description.toLowerCase().includes(searchTerm.toLowerCase());
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 'dueDate' || 'duedate' || 'DueDate' || 'Duedate' || 'due date' || 'Due date' || 'due-date':
260
+ case 'duedate':
260
261
  sortedTasks.sort((a, b) => new Date(a.dueDate) - new Date(b.dueDate));
261
262
  break;
262
- case 'priority' || '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' || 'Status':
267
+ case 'status':
267
268
  const statusOrder = { 'todo': 1, 'in-progress': 2, 'done': 3 };
268
- sortedTasks.sort((a, b) => statusOrder[a.priority] - statusOrder[b.priority]);
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: "rawlist",
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
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.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",
package/images/add.png DELETED
Binary file
package/images/delete.png DELETED
Binary file
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