Task Tracker is a simple command-line interface (CLI) application built entirely in C++ (using C++20 standards) to help you manage your tasks. It allows you to add new tasks, update existing ones, mark their progress (todo, in-progress, done), delete tasks, and list them based on their status.
This project serves as a practical exercise in C++ programming, covering:
- Command-line argument parsing (
argc,argv) - File I/O using standard C++ libraries (
<fstream>) - Basic manual JSON parsing and serialization (without external libraries)
- Object-Oriented Programming principles (using a
Taskclass) - Working with standard containers (
std::vector) and algorithms (<algorithm>) - Date and time handling (
<chrono>)
- Add Tasks: Add new tasks with a description.
- Update Tasks: Modify the description of an existing task.
- Delete Tasks: Remove tasks by their unique ID.
- Track Status: Mark tasks as
todo,in-progress, ordone. - List Tasks:
- List all tasks.
- List tasks filtered by status (
todo,in-progress,done).
- Data Persistence: Tasks are saved to a
tasks.jsonfile in the current directory. - No Dependencies: Uses only standard C++ libraries.
- A C++ compiler supporting C++11 or later (e.g., g++, Clang).
- A command-line terminal or shell (Linux, macOS, Windows with MinGW/WSL/Developer Command Prompt).
To Compile the program: Open your terminal, navigate to the directory containing task-cli.cpp, and run the command:
g++ task-cli.cpp -o task-cli -std=c++20If successful, you will find an executable file named task-cli (or task-cli.exe) in the same directory.
Run the application from your terminal using the compiled executable (./task-cli on Linux/macOS, task-cli.exe or .\task-cli.exe on Windows).
Command Line Syntax:
./task-cli <command> [arguments...]-
add <"description">- Adds a new task with the given description.
- Important: Enclose the description in double quotes (
") if it contains spaces. - Example:
./task-cli add "Buy groceries and cook dinner"
-
update <id> <"description">- Updates the description of the task with the specified
<id>. - Important: Enclose the new description in double quotes (
") if it contains spaces. - Example:
./task-cli update 1 "Buy groceries only"
- Updates the description of the task with the specified
-
delete <id>- Deletes the task with the specified
<id>. - Example:
./task-cli delete 3
- Deletes the task with the specified
-
mark-in-progress <id>- Marks the task with the specified
<id>as 'in-progress'. - Example:
./task-cli mark-in-progress 2
- Marks the task with the specified
-
mark-done <id>- Marks the task with the specified
<id>as 'done'. - Example:
./task-cli mark-done 1
- Marks the task with the specified
-
mark-todo <id>- Marks the task with the specified
<id>as 'todo'. - Example:
./task-cli mark-todo 2
- Marks the task with the specified
-
list [filter]- Lists tasks.
- If no
[filter]is provided orallis used, lists all tasks. - Optional
[filter]can be one of:todo,in-progress,done. - Examples:
./task-cli list(Lists all tasks)./task-cli list done(Lists only completed tasks)./task-cli list todo(Lists only tasks yet to be started)
-
helpor--help- Displays the usage instructions and available commands.
- Example:
./task-cli help
- Tasks are stored in a JSON file named
tasks.json. - This file is created automatically in the same directory where you run the
task-cliexecutable if it doesn't already exist. - The file contains a JSON array of task objects, each having
id,description,status,createdAt, andupdatedAtfields.
- Basic JSON Handling: The JSON parsing and serialization are implemented manually without external libraries. This makes the handling less robust than using a dedicated library. It may fail if the
tasks.jsonfile is manually edited incorrectly or contains complex escaped characters not handled by the basic escaping/unescaping logic. - Error Handling: Basic error handling is implemented, but more complex edge cases might not be covered.
- Concurrency: This application is not designed for simultaneous use by multiple processes or users modifying the same
tasks.jsonfile.
- Project hosted at: https://roadmap.sh/projects/task-tracker