https://github.com/tokiory/todo-c
ðĶĪ Simple CLI utility for todo management written in C
https://github.com/tokiory/todo-c
Last synced: 7 months ago
JSON representation
ðĶĪ Simple CLI utility for todo management written in C
- Host: GitHub
- URL: https://github.com/tokiory/todo-c
- Owner: tokiory
- Created: 2025-06-17T15:53:48.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-06-17T16:45:49.000Z (7 months ago)
- Last Synced: 2025-06-17T16:51:13.949Z (7 months ago)
- Language: C
- Size: 0 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Todo-C
A simple, lightweight command-line todo application written in C with custom data structures and file-based storage.
## Features
- â
Create, read, update, and delete tasks
- â
Mark tasks as completed
- â
Persistent file-based storage
- â
UUID-based task identification
- â
Custom hashmap and vector implementations
- â
Multiple command aliases for convenience
## Architecture
The application is built with a modular architecture:
- **Custom Data Structures**: Implementation of hashmap and vector from scratch
- **Storage Layer**: File-based persistence with tab-separated values
- **Command Processing**: Flexible command parsing with multiple aliases
- **Adapter Pattern**: Clean separation between storage and business logic
## Building
### Prerequisites
- CMake 3.16 or higher
- C99 compatible compiler (GCC, Clang)
- UUID library (`libuuid-dev` on Ubuntu/Debian, `uuid-dev` on other systems)
### Build Instructions
```bash
# Clone the repository
git clone
cd todo-c
# Create build directory
mkdir build
cd build
# Configure and build
cmake ..
make
# Run the application
./todo-c
```
## Usage
### Basic Commands
```bash
# Show help
./todo-c help
./todo-c h
./todo-c -h
./todo-c --help
# Add a new task
./todo-c add "Buy groceries"
./todo-c a "Buy groceries"
./todo-c -a "Buy groceries"
./todo-c --add "Buy groceries"
# List all tasks
./todo-c ls
./todo-c --list
./todo-c -l
# Mark a task as done
./todo-c done
./todo-c do
./todo-c --done
# Update a task
./todo-c upd "New task title"
./todo-c u "New task title"
./todo-c --update "New task title"
./todo-c -u "New task title"
# Delete a task
./todo-c del
./todo-c d
./todo-c -d
./todo-c --del
```
## Data Storage
Tasks are stored in a tab-separated file (`storage.txt`) with the following format:
```
\t\t
```
Where:
- `task-id`: UUID string
- `task-title`: Task description
- `is-done`: "1" for completed, "0" for pending
## Project Structure
```
todo-c/
âââ src/
â âââ main.c # Entry point and command dispatch
â âââ command.c # Command parsing and help
â âââ todo.c # Core todo logic
â âââ storage.c # File I/O operations
â âââ adapter.c # Storage-Todo conversion
â âââ lib/
â âââ hashmap.c # Custom hashmap implementation
â âââ vector.c # Dynamic array implementation
âââ include/
â âââ command.h
â âââ todo.h
â âââ storage.h
â âââ adapter.h
â âââ lib/
â âââ hashmap.h
â âââ vector.h
âââ CMakeLists.txt # Build configuration
âââ README.md
```
## Implementation Details
### Custom Data Structures
- **Hashmap**: Uses FNV1A hash function with linked list collision resolution
- **Vector**: Dynamic array with automatic resizing (doubles capacity when full)
### Error Handling
- Graceful handling of missing files (creates new storage)
- Input validation for commands
- Proper error messages for invalid operations
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Ensure all memory leaks are fixed
5. Test thoroughly
6. Submit a pull request
## Dependencies
- **libuuid**: For generating unique task identifiers
- **CMake**: Build system
- **Standard C Library**: Core functionality
## Development Notes
- Uses C99 standard
- Debug builds include `-g -O0` flags
- Compile commands are exported for IDE integration
- Custom implementations prioritize learning over performance