Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FranksGP/Gestor_de_tareas/llms.txt

Use this file to discover all available pages before exploring further.

When a task is no longer needed — whether it has been completed or simply cancelled — you can remove it permanently using option 4. Like the complete workflow, the application automatically displays your current task list before prompting for input, giving you the correct index at a glance. Once confirmed, the task is popped from the in-memory list and the updated list is written back to Tareas.json. The deletion is immediate and the remaining tasks are re-indexed on the next listing.

Workflow

1

Run the application

Open a terminal in the directory that contains index.py and start the program:
python index.py
The main menu is displayed:
Gestor de Tareas
1. Agregar tarea
2. Listar tareas
3. Marcar tarea como completada
4. Eliminar tarea
5. Salir
2

Select option 4

At the prompt, type 4 and press Enter:
Seleccione una opción: 4
The application automatically calls listarTask() and prints your current tasks before asking for input.
3

Review the task list and enter the task number

The current task list is shown. Identify the number of the task you want to delete, then enter it and press Enter:
Ingrese el número de la tarea a eliminar: 1
4

Confirm the deletion

A confirmation message is printed, including the title of the task that was removed:
Tarea 'Comprar leche' eliminada.
The task no longer exists in Tareas.json.

Full terminal example

The following example starts with two tasks and deletes the first one:
Gestor de Tareas
1. Agregar tarea
2. Listar tareas
3. Marcar tarea como completada
4. Eliminar tarea
5. Salir
Seleccione una opción: 4
1. Comprar leche - Ir al supermercado [✘ Pendiente]
2. Estudiar Python - Repasar funciones [✔ Completada]
Ingrese el número de la tarea a eliminar: 1
Tarea 'Comprar leche' eliminada.

What happens internally

When you enter a valid task number, the application calls delete_task(index):
  1. cargarTask() reads the current contents of Tareas.json into a Python list.
  2. The function checks that the provided index satisfies 0 < index <= len(tasks). If so, it calls tasks.pop(index - 1), which removes the task object at that position and stores it in deleted_task.
  3. guardarTask(tasks) writes the remaining tasks back to Tareas.json.
  4. The confirmation message Tarea '{deleted_task["titulo"]}' eliminada. is printed, displaying the title of the removed task.

Error handling

Option 4 handles two error conditions:
  • Invalid index: If you enter a number that is less than 1 or greater than the total number of tasks, delete_task prints the following and makes no changes to Tareas.json:
    Índice inválido.
    
  • Non-integer input: If you type something that is not a whole number (for example abc or 2.5), the ValueError is caught and the following message is printed instead:
    Entrada inválida. Debe ingresar un número.
    
In both cases the main menu reappears and you can try again with a valid entry.
Deletion is permanent. Once a task is removed from Tareas.json there is no undo option within the application. Before entering a task number, carefully review the list that is printed automatically to make sure you are targeting the correct entry.
Index shifting: After a task is deleted, every task that was positioned after it shifts down by one. For example, if you had tasks numbered 1, 2, and 3 and you delete task 1, the former task 2 becomes the new task 1, and the former task 3 becomes the new task 2. Always re-list your tasks after a deletion before performing further operations to avoid acting on the wrong entry.

Build docs developers (and LLMs) love