Skip to content

NeonWest/ToDoList-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โœ… Todo CLI Application

A powerful, elegant command-line todo list manager built with Java and Maven. Keep track of your tasks, mark them complete, and manage your productivity directly from your terminal!

๐Ÿš€ Features

  • ๐Ÿ“ Add Tasks - Quickly create new todos with a simple command
  • ๐Ÿ“‹ View Active Tasks - Display all your pending tasks at a glance
  • โœ“ Mark as Complete - Archive completed tasks without deleting them
  • ๐Ÿ—‘๏ธ Delete Tasks - Permanently remove tasks you no longer need
  • ๐Ÿ“Š View Completed Tasks - Review your accomplishments in a separate list
  • ๐Ÿ’พ Persistent Storage - All tasks are automatically saved in JSON format
  • ๐Ÿ‘ค User Profiles - Personalized experience with user registration
  • ๐Ÿ”„ Smart Renumbering - Tasks are automatically renumbered after modifications
  • ๐ŸŽฏ Intuitive Interface - Clean, menu-driven interface for easy navigation
  • ๐Ÿณ Docker Support - Run anywhere with Docker containerization
  • ๐Ÿ”„ CI/CD Pipeline - Automated builds and deployments with GitHub Actions

๐Ÿ› ๏ธ Tech Stack

  • Java - Core programming language
  • Maven - Dependency management and build tool
  • Gson - JSON serialization/deserialization
  • Docker - Containerization platform
  • GitHub Actions - CI/CD automation

๐Ÿ“‹ Prerequisites

Local Development

  • Java 17 or higher
  • Maven 3.8+

Docker Deployment

  • Docker Desktop installed
  • Docker Hub account (for CI/CD)

๐Ÿ”ง Installation & Running

Option 1: Traditional Java (Local)

  1. Clone the repository

    git clone https://github.com/NeonWest/ToDoList-CLI.git
    cd ToDoList-CLI
  2. Build the project

    mvn clean install
  3. Run the application

    mvn exec:java -Dexec.mainClass="com.omar.todo.TodoMain"

Option 2: Docker (Recommended)

  1. Clone the repository

    git clone https://github.com/NeonWest/ToDoList-CLI.git
    cd ToDoList-CLI
  2. Build and run with Docker

    docker build -t todo-cli .
    docker run -it --rm -v $(pwd)/data:/app/data todo-cli
  3. Or use Docker Compose

    docker-compose up --build

    Then in another terminal:

    docker attach todo-app
  4. Pull from Docker Hub (after CI/CD setup)

    docker pull <your-dockerhub-username>/todo-cli:latest
    docker run -it --rm -v $(pwd)/data:/app/data <your-dockerhub-username>/todo-cli:latest

Option 3: Quick Alias (macOS/Linux)

Add to your ~/.zshrc or ~/.bashrc:

alias runtodo="docker run -it --rm -v $(pwd)/data:/app/data todo-cli"

Then simply run:

runtodo

๐ŸŽฎ Usage

When you launch the application, you'll see an interactive menu:

---To Do Cli Application---
Options:
1: Add a new task
2: Show your tasks
3: Delete a task
4: Mark task as complete
5: View completed tasks
6: Quit

Adding a Task

  1. Select option 1
  2. Enter your task description
  3. Task is automatically numbered and saved

Viewing Active Tasks

  1. Select option 2
  2. All incomplete tasks are displayed with their numbers
  3. Completed tasks are hidden from this view

Deleting a Task

  1. Select option 3
  2. Enter the task number you want to delete
  3. Task is permanently removed and remaining tasks are renumbered

Marking Tasks as Complete

  1. Select option 4
  2. Enter the task number to mark as done
  3. Task is archived but not deleted
  4. Task becomes unnumbered and moves to completed list

Viewing Completed Tasks

  1. Select option 5
  2. All completed tasks are displayed with checkmarks
  3. These tasks don't show numbers (archived state)

Exiting

Select option 6 to quit the application

๐Ÿ“ Project Structure

todo-cli/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ docker-build.yml    # CI/CD pipeline
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ main/
โ”‚       โ””โ”€โ”€ java/
โ”‚           โ””โ”€โ”€ com/
โ”‚               โ””โ”€โ”€ omar/
โ”‚                   โ””โ”€โ”€ todo/
โ”‚                       โ”œโ”€โ”€ TodoMain.java       # Main application entry
โ”‚                       โ”œโ”€โ”€ UserData.java       # User data model
โ”‚                       โ”œโ”€โ”€ Todoformat.java     # Todo item model
โ”‚                       โ””โ”€โ”€ JsonEditor.java     # JSON operations
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ todolist.json           # Data storage (auto-generated)
โ”œโ”€โ”€ Dockerfile                  # Docker build instructions
โ”œโ”€โ”€ docker-compose.yml          # Docker Compose configuration
โ”œโ”€โ”€ .dockerignore              # Docker ignore rules
โ”œโ”€โ”€ pom.xml                    # Maven configuration
โ””โ”€โ”€ README.md

๐Ÿณ Docker Details

Dockerfile Highlights

  • Multi-stage build for optimized image size
  • Stage 1: Maven build environment
  • Stage 2: Lightweight JRE runtime (Alpine-based)
  • Persistent data storage via volumes

Data Persistence

  • Todo data is stored in /app/data/todolist.json inside the container
  • Volume mount -v $(pwd)/data:/app/data ensures data persists on your host machine
  • Your tasks survive container restarts and removals

๐Ÿ”„ CI/CD Pipeline

Automated Workflow

Every push to main or master branch triggers:

  1. โœ… Code checkout
  2. โœ… Java 17 setup
  3. โœ… Maven build
  4. โœ… Docker image creation
  5. โœ… Push to Docker Hub with two tags:
    • latest - always points to the newest version
    • <commit-sha> - specific version for rollbacks

Setup CI/CD

  1. Fork/clone this repository
  2. Create a Docker Hub account
  3. Generate Docker Hub access token (Settings โ†’ Security โ†’ New Access Token)
  4. Add secrets to GitHub repository:
    • Go to Settings โ†’ Secrets and variables โ†’ Actions
    • Add DOCKER_USERNAME (your Docker Hub username)
    • Add DOCKER_PASSWORD (your Docker Hub access token)
  5. Push to trigger the workflow

๐Ÿ“ฆ Dependencies

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.10.1</version>
</dependency>

๐Ÿ’ก Example Session

---To Do Cli Application---
Please enter your name for registration
> Omar

Options:
1: Add a new task
2: Show your tasks
3: Delete a task
4: Mark task as complete
5: View completed tasks
6: Quit
> 1

Please enter the task:
> Buy groceries
Task added successfully!

> 2
Your Tasks:
1. Buy groceries
2. Finish project
3. Call dentist

> 4
Which task is completed? (ID):
> 2
Task marked as complete!

> 5
Completed Tasks:
โœ“ Finish project

๐ŸŽฏ Key Features Explained

Smart Task Management

  • Active tasks are numbered sequentially (1, 2, 3...)
  • Completed tasks become unnumbered (archived state)
  • Automatic renumbering keeps your list clean after deletions

Data Persistence

  • All tasks are saved to todolist.json automatically
  • Your data persists between sessions and container restarts
  • First-time users are prompted to register their name

Input Validation

  • Invalid inputs are caught and user is prompted to retry
  • Task IDs are verified before operations
  • Helpful error messages guide the user

Containerization Benefits

  • Consistency - Runs the same everywhere
  • Portability - Share via Docker Hub
  • Isolation - No dependency conflicts
  • Easy deployment - One command to run

๐Ÿ”ฎ Future Enhancements

Application Features

  • Edit existing tasks
  • Task priorities (high, medium, low)
  • Due dates and reminders
  • Categories/tags for organization
  • Search functionality
  • Sort and filter options
  • Export to different formats (CSV, PDF)
  • Undo/redo functionality
  • Recurring tasks

DevOps Features

  • Unit tests integration
  • Kubernetes deployment manifests
  • Helm charts
  • Multi-architecture Docker builds (ARM64 support)
  • Automated testing in CI pipeline
  • Code coverage reports

๐Ÿค Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ› Troubleshooting

Docker Issues

  • Container exits immediately: Ensure you're using -it flag for interactive mode
  • Data not persisting: Check volume mount path is correct
  • Permission errors: Ensure Docker has access to the data directory

Build Issues

  • Maven build fails: Verify Java 17+ is installed
  • Docker build fails: Check Dockerfile syntax and base image availability

๐Ÿ“š Learning Resources

This project demonstrates:

  • Java CLI application development
  • Maven dependency management
  • Docker containerization (multi-stage builds)
  • Docker Compose orchestration
  • GitHub Actions CI/CD pipelines
  • Volume management for data persistence

๐Ÿ‘จโ€๐Ÿ’ป Author

Omar Atakishiyev


โญ If you find this project useful, please consider giving it a star!

Built with โ˜• and Java | Containerized with ๐Ÿณ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published