Skip to main content

A production-ready CLI task management application with colors, priorities, and statistics

Project description

CLI Task Manager

A production-ready, feature-rich command-line task management application with colorful output, comprehensive testing, and advanced features.

Features

Core Functionality

  • Add Tasks - Create tasks with titles, priorities, and due dates
  • List Tasks - View all tasks in a formatted, colored table
  • Complete Tasks - Mark tasks as done with timestamps
  • Delete Tasks - Remove tasks permanently
  • Update Tasks - Modify task titles
  • Filter Tasks - Show tasks by status (pending/in_progress/completed)

Advanced Features (Phase 6)

  • Search - Find tasks by keyword
  • Priorities - Set task priority (low/medium/high)
  • Due Dates - Assign and track deadlines
  • Statistics - View comprehensive task analytics
  • Colorful Output - Cross-platform colored terminal
  • 90%+ Test Coverage - Comprehensive unit tests

Color Scheme

Color Usage Example
Green Success, Completed Task added, Completed
Red Errors, High Priority Task not found, High
Yellow Warnings, Pending, Medium Warning, Medium
Blue Info, In Progress, Low Info, Low
Cyan Info messages Task counts

Installation

git clone <your-repo-url>
cd task-manager
pip install -r requirements.txt

Requirements

  • Python 3.8+
  • tabulate>=0.9.0 - Table formatting
  • colorama>=0.4.6 - Cross-platform colors
  • pytest>=7.4.0 - Testing framework
  • pytest-cov>=4.0.0 - Coverage reporting

Quick Start

python main.py add "Buy groceries"
python main.py add "Complete report" --priority high --due 2026-01-15
python main.py list
python main.py list --status pending
python main.py search "groceries"
python main.py complete 1
python main.py priority 2 high
python main.py due 2 2026-01-20
python main.py stats
python main.py delete 3

Commands Reference

Add Task

python main.py add "Task title" [--priority low|medium|high] [--due YYYY-MM-DD]

Examples:

python main.py add "Buy milk"
python main.py add "Finish project" --priority high
python main.py add "Submit report" --priority high --due 2026-01-20

List Tasks

python main.py list [--status pending|in_progress|completed]

Examples:

python main.py list
python main.py list --status completed

Complete Task

python main.py complete <task_id>

Delete Task

python main.py delete <task_id>

Update Task

python main.py update <task_id> "New title"

Search Tasks

python main.py search "keyword"

Set Priority

python main.py priority <task_id> low|medium|high

Set Due Date

python main.py due <task_id> YYYY-MM-DD

View Statistics

python main.py stats

Statistics Example

$ python main.py stats

Task Statistics

Status Overview:
   Total Tasks: 5
   Pending: 2 (40%)
   In Progress: 1 (20%)
   Completed: 2 (40%)

Priority:
   High: 2

Due Dates:
   Due Today: 1
   Overdue: 0

Performance:
   Avg. Completion Time: 2.5 days

Running Tests

pytest
pytest --cov
pytest --cov --cov-report=term-missing
pytest tests/test_task_manager.py
pytest --cov --cov-report=html

Expected Coverage: 90%+

Project Structure

task-manager/
├── main.py              # CLI entry point
├── task_manager.py      # Core business logic
├── file_handler.py      # JSON operations & migration
├── constants.py         # Configuration & colors
├── ui_helpers.py        # Color utility functions
├── tasks.json           # Data storage (auto-created)
├── requirements.txt     # Dependencies
├── pyproject.toml       # Pytest configuration
├── README.md            # Documentation
└── tests/               # Unit tests
    ├── conftest.py      # Pytest fixtures
    ├── test_file_handler.py
    ├── test_task_manager.py
    └── test_main.py

Task Data Structure

{
  "version": "2.0",
  "last_updated": "2026-01-11 10:00:00",
  "tasks": [
    {
      "id": 1,
      "title": "Buy groceries",
      "status": "pending",
      "priority": "medium",
      "due_date": "2026-01-15",
      "created_at": "2026-01-11 09:00:00",
      "completed_at": null
    }
  ]
}

Data Migration

The application automatically migrates old task formats to the new schema.

Old Format (v1.0):

[
  {
    "id": 1,
    "title": "Task",
    "status": "pending",
    "created_at": "2026-01-10"
  }
]

New Format (v2.0) automatically adds:

  • priority (default: "medium")
  • due_date (default: null)
  • completed_at (default: null)
  • Version metadata

Validation Rules

  • Title Length: 1-200 characters
  • Task ID: Positive integers only
  • Priority: low, medium, or high
  • Due Date: YYYY-MM-DD format
  • Status: pending, in_progress, or completed

Disabling Colors

Colors are automatically disabled when:

  • Output is redirected (> file.txt)
  • Terminal doesn't support colors

Manual disable in constants.py:

USE_COLORS = False

Example Session

$ python main.py add "Buy groceries" --priority high --due 2026-01-15
Task added successfully (ID: 1)
   "Buy groceries"
   Priority: high
   Due: 2026-01-15

$ python main.py add "Write documentation" --priority medium
Task added successfully (ID: 2)
   "Write documentation"
   Priority: medium

$ python main.py list

+----+----------------------+-----------+-----------+------------+---------------------+
| ID | Title                | Status    | Priority  | Due Date   | Created At          |
+====+======================+===========+===========+============+=====================+
|  1 | Buy groceries        | Pending   | High      | 2026-01-15 | 2026-01-11 10:00:00 |
|  2 | Write documentation  | Pending   | Medium    | -          | 2026-01-11 10:01:00 |
+----+----------------------+-----------+-----------+------------+---------------------+

Total tasks: 2

$ python main.py complete 1
Task 1 marked as completed!
   "Buy groceries"

$ python main.py search "doc"
Found 1 task(s) matching: "doc"

+----+----------------------+-----------+-----------+
| ID | Title                | Status    | Priority  |
+====+======================+===========+===========+
|  2 | Write documentation  | Pending   | Medium    |
+----+----------------------+-----------+-----------+

$ python main.py stats

Task Statistics

Status Overview:
   Total Tasks: 2
   Pending: 1 (50%)
   In Progress: 0 (0%)
   Completed: 1 (50%)

Priority:
   High: 1

Due Dates:
   Due Today: 0
   Overdue: 0

Performance:
   Avg. Completion Time: 0.0 days

Testing Guide

Install Test Dependencies

pip install -r requirements.txt

Run Tests

pytest
pytest -v
pytest --cov
pytest --cov --cov-report=term-missing
pytest --cov --cov-report=html

Expected Test Output

$ pytest -v

================================ test session starts =================================
collected 25 items

tests/test_file_handler.py::test_read_empty_file PASSED                        [  4%]
tests/test_file_handler.py::test_write_and_read_tasks PASSED                   [  8%]
tests/test_file_handler.py::test_read_corrupted_json PASSED                    [ 12%]
tests/test_task_manager.py::test_add_task_success PASSED                       [ 52%]
tests/test_task_manager.py::test_complete_task_success PASSED                  [ 68%]
tests/test_task_manager.py::test_search_tasks_found PASSED                     [ 92%]

================================ 25 passed in 1.23s ==================================

Coverage Report Example

$ pytest --cov --cov-report=term-missing

---------- coverage: platform win32, python 3.11.0 -----------
Name                    Stmts   Miss  Cover   Missing
-----------------------------------------------------
constants.py               45      2    96%   12-13
file_handler.py            78      4    95%   23, 67, 89, 103
main.py                    56      8    86%   72-76, 95-98
task_manager.py           145      8    94%   45, 78, 112, 156
ui_helpers.py              82      5    94%   34, 67, 89, 112
-----------------------------------------------------
TOTAL                     406     27    93%

Example tasks.json (Schema v2.0)

{
  "version": "2.0",
  "last_updated": "2026-01-11 14:30:00",
  "tasks": [
    {
      "id": 1,
      "title": "Buy groceries",
      "status": "completed",
      "priority": "high",
      "due_date": "2026-01-15",
      "created_at": "2026-01-11 09:00:00",
      "completed_at": "2026-01-11 12:30:00"
    },
    {
      "id": 2,
      "title": "Write documentation",
      "status": "in_progress",
      "priority": "medium",
      "due_date": "2026-01-20",
      "created_at": "2026-01-11 10:00:00",
      "completed_at": null
    },
    {
      "id": 3,
      "title": "Review pull requests",
      "status": "pending",
      "priority": "low",
      "due_date": null,
      "created_at": "2026-01-11 11:00:00",
      "completed_at": null
    }
  ]
}

Success Checklist

  • Phase 1 - Foundation (add, list)
  • Phase 2 - Complete & delete features
  • Phase 3 - Refactoring & status filtering
  • Phase 4 - Color polish & cross-platform support
  • Phase 5 - Testing & validation (90%+ coverage)
  • Phase 6 - Advanced features (search, priority, stats)

Verification Commands

pytest
pytest --cov
python main.py add "Test"
python main.py list
python main.py search "test"
python main.py priority 1 high
python main.py stats

Deployment Checklist

  • All tests pass (pytest)
  • Coverage >= 90% (pytest --cov)
  • No syntax errors (python -m py_compile *.py)
  • README is complete
  • requirements.txt is up to date
  • Example tasks.json provided
  • Color output tested on target platform
  • Data migration tested with old files

Tips & Tricks

Batch Operations

python main.py add "Task 1" --priority high
python main.py add "Task 2" --priority medium
python main.py add "Task 3" --due 2026-01-20

Viewing Specific Task Types

python main.py list --status pending
python main.py list --status completed

Backup Your Data

cp tasks.json tasks.backup.json
cp tasks.backup.json tasks.json

Troubleshooting

Colors Not Showing

  • Ensure colorama is installed: pip install colorama
  • Check terminal supports colors
  • Verify USE_COLORS = True in constants.py

Tests Failing

  • Install test dependencies: pip install pytest pytest-cov
  • Ensure you're in the project directory
  • Check Python version >= 3.8

File Permission Errors

  • Ensure write permissions in project directory
  • Try running with elevated permissions (if necessary)

Invalid Date Format

  • Use YYYY-MM-DD format: 2026-01-15
  • Don't use slashes or other separators

Version History

  • v1.0 - Foundation (add, list)
  • v2.0 - Complete & delete features
  • v3.0 - Refactoring & status filtering
  • v4.0 - Color polish
  • v5.0 - Testing & validation
  • v6.0 - Advanced features (search, priority, due dates, stats)

Future Enhancements

  • Task categories/tags
  • Recurring tasks
  • Task notes/descriptions
  • Export to CSV/PDF
  • Undo/redo operations
  • Task dependencies
  • Time tracking
  • Multi-user support

License

MIT License - Feel free to use and modify!


Built with Python Production-Ready | Fully Tested | Feature-Rich

Status: Production Ready Test Coverage: 93% All Features: Working

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_task_manager_ronel-1.0.0.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_task_manager_ronel-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file cli_task_manager_ronel-1.0.0.tar.gz.

File metadata

  • Download URL: cli_task_manager_ronel-1.0.0.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for cli_task_manager_ronel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 248e053462b5204df95efdd3f1ac1c50c093ceff796847ca2ba75453ae5fef1e
MD5 9d20643c0a004d99e7255b48e4a5a07f
BLAKE2b-256 624cea0b515cde1eeb6af16ef2d0be7c3c3e0fc8da3fe95d8612404f85f3b112

See more details on using hashes here.

File details

Details for the file cli_task_manager_ronel-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cli_task_manager_ronel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19b50b93edc152a988481b80b211c35834ad0f38e224c90a7f6b45c540d04905
MD5 89c69b7e474accddb4d63d8736d5d30b
BLAKE2b-256 1d6241742e67eec4360d659f87f57317a5f640cf3b49709b243ccebe948c8d7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page