Skip to main content

๐Ÿš€ A powerful work time tracking tool for the command line

Project description

Drudge CLI - Professional Work Time Tracking Tool

GitHub Python Version License Version

A comprehensive, professionally architected command-line tool for tracking work time on tasks with organized daily logs. Built with modern Python package structure, Typer CLI framework, Rich formatting, type hints, dataclasses, and enterprise-level architectural patterns.

๐ŸŽฏ Version 2.1.0 - Enhanced CLI: Native help system, enhanced end command with --all flag, and powerful clean command for worklog management.

โœจ Key Features

๐Ÿš€ Task Management

  • Smart task tracking: Start, end, pause, and resume tasks
  • Anonymous work sessions: Start working without naming the task
  • Single-task mode: Auto-ends previous tasks (default behavior)
  • Parallel mode: Work on multiple tasks simultaneously with --parallel flag
  • Custom timestamps: Backdate entries with --time HH:MM
  • Pause/Resume: Interrupt work and continue later

๐Ÿ“Š Reporting & Views

  • Unified list command: See active, paused, and completed tasks at a glance
  • Recent tasks: View detailed recent work history
  • Daily summaries: Time totals and task breakdown by day
  • Flexible filtering: By date, task name, or custom limits

๐Ÿ—‘๏ธ NEW in v2.1.0: Clean Command

  • Clean by date: Remove all entries for a specific date
  • Clean by task: Remove all entries for a task across all dates
  • Selective cleaning: Clean task entries for specific date only
  • Clean all: Reset entire worklog with confirmation
  • Automatic backups: Safety first - backups before deletion

๐Ÿ ENHANCED in v2.1.0: End Command

  • Default: drudge end - Ends only active tasks
  • New --all flag: drudge end --all - Ends active AND paused tasks

โ“ IMPROVED in v2.1.0: Help System

  • Native Typer --help integration
  • Command-specific help: drudge COMMAND --help
  • Consistent with standard CLI conventions

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.8+ (tested with Python 3.10 and 3.13)
  • Required packages: typer[all] and rich

Install from PyPI

pip install drudge-cli

Install from Source

# Clone the repository
git clone https://github.com/Trik16/drudge.git
cd drudge

# Install in development mode
pip install -e .

Setup Shell Alias

# Run the setup script
./setup_drudge_alias.sh

# Or add manually to your shell config
echo 'alias drudge="python3 -m src.worklog"' >> ~/.zshrc
source ~/.zshrc

๐Ÿš€ Quick Start

# Start your workday
drudge start "Morning emails"

# Check what's active
drudge list

# End the task
drudge end "Morning emails"

# View today's summary
drudge daily

๐Ÿ“– Command Reference

Command Description Example
Task Management
drudge start "Name" ๐Ÿš€ Start a new task (auto-ends previous) drudge start "Bug fix #123"
drudge start ๐Ÿš€ Start anonymous work session drudge start
drudge start --parallel ๐Ÿš€ Start without ending active tasks drudge start "Review" --parallel
drudge start --time HH:MM ๐Ÿš€ Start at specific time drudge start "Meeting" --time 09:30
drudge end "Name" ๐Ÿ End a specific task drudge end "Bug fix #123"
drudge end ๐Ÿ End ALL active tasks (paused remain) drudge end
drudge end --all ๐Ÿ NEW End active AND paused tasks drudge end --all
drudge end --time HH:MM ๐Ÿ End at specific time drudge end "Meeting" --time 17:30
drudge pause "Name" โธ๏ธ Pause an active task drudge pause "Task"
drudge resume "Name" โ–ถ๏ธ Resume a paused task drudge resume "Task"
Cleaning & Maintenance
drudge clean YYYY-MM-DD ๐Ÿ—‘๏ธ NEW Clean all entries for date drudge clean 2025-10-03
drudge clean "Task" ๐Ÿ—‘๏ธ NEW Clean task (all dates) drudge clean "Bug fix"
drudge clean "Task" --date ๐Ÿ—‘๏ธ NEW Clean task for specific date drudge clean "Meeting" -d 2025-10-03
drudge clean --all ๐Ÿ—‘๏ธ NEW Clean ALL entries (confirm) drudge clean --all
Viewing & Reporting
drudge list ๐Ÿ“‹ Show active, paused, completed drudge list
drudge list --date YYYY-MM-DD ๐Ÿ“‹ List entries for date drudge list --date 2025-10-03
drudge list --task "keyword" ๐Ÿ“‹ Filter by task name drudge list --task "bug"
drudge list --limit N ๐Ÿ“‹ Limit results drudge list --limit 10
drudge recent ๐Ÿ“ Recent tasks (full details) drudge recent
drudge recent --limit N ๐Ÿ“ Show N recent tasks drudge recent --limit 10
drudge daily ๐Ÿ“… Today's summary drudge daily
drudge daily --date YYYY-MM-DD ๐Ÿ“… Specific date summary drudge daily --date 2025-10-03
Help & Info
drudge --help โ“ IMPROVED Main help drudge --help
drudge COMMAND --help โ“ IMPROVED Command help drudge start --help
drudge config โš™๏ธ Show configuration drudge config
drudge version ๐Ÿ“ฆ Show version drudge version

๐Ÿ’ก Usage Examples

Basic Task Tracking

# Start a task
$ drudge start "Fix bug #123"
๐Ÿš€ Started 'Fix bug #123' at 2025-10-04 10:00:00

# End it
$ drudge end "Fix bug #123"
๐Ÿ Completed 'Fix bug #123' at 2025-10-04 12:30:00 (Duration: 02:30:00)

Anonymous Work Session

# Don't know what you're working on yet?
$ drudge start
๐Ÿ’ก Starting anonymous work session

# Name it later (converts anonymous โ†’ named)
$ drudge start "Research and planning"
โœ๏ธ Renamed anonymous work to 'Research and planning'

Parallel Tasks

# Work on multiple tasks simultaneously
$ drudge start "Backend API"
$ drudge start "Code review" --parallel  # Keeps Backend API running

$ drudge list
๐Ÿ”ฅ ACTIVE TASKS:
  โ€ข Backend API (Running: 01:00:00)
  โ€ข Code review (Running: 00:15:00)

# End specific task
$ drudge end "Code review"
๐Ÿ Completed 'Code review' (Duration: 00:30:00)

Pause and Resume

# Working on a task
$ drudge start "Important project"

# Lunch break
$ drudge pause "Important project"
โธ๏ธ Paused 'Important project'

# Back from lunch
$ drudge resume "Important project"
โ–ถ๏ธ Resumed 'Important project'

# Finish up
$ drudge end "Important project"
๐Ÿ Completed 'Important project' (Duration: 03:30:00)

Enhanced End Command (v2.1.0)

# Create test scenario
$ drudge start "Active Task"
$ drudge start "Another Task" --parallel
$ drudge pause "Active Task"

$ drudge list
๐Ÿ”ฅ ACTIVE TASKS:
  โ€ข Another Task (Running: 00:05:00)

โธ๏ธ  PAUSED TASKS:
  โ€ข Active Task

# End only active tasks (DEFAULT behavior)
$ drudge end
โœ… Ended 1 task(s) successfully  # Only "Another Task" ended

$ drudge list
โธ๏ธ  PAUSED TASKS:
  โ€ข Active Task  # Paused task remains!

# End ALL tasks including paused (NEW --all flag)
$ drudge end --all
โ–ถ๏ธ Resumed 'Active Task'
๐Ÿ Completed 'Active Task'
โœ… Ended 1 task(s) successfully

Clean Command (v2.1.0)

# Clean all entries for a specific date
$ drudge clean 2025-10-03
โœ… Cleaned 15 entries for 2025-10-03
๐Ÿ’พ Backup created for safety

# Clean all entries for a task (across all dates)
$ drudge clean "Bug fix #123"
โœ… Cleaned 3 entries for task 'Bug fix #123'
๐Ÿ’พ Backup created for safety

# Clean task entries for specific date only
$ drudge clean "Meeting" --date 2025-10-03
โœ… Cleaned 1 entries for task 'Meeting' on 2025-10-03
๐Ÿ’พ Backup created for safety

# Clean everything (with confirmation)
$ drudge clean --all
โš ๏ธ  This will clean ALL worklog entries!
Are you sure you want to continue? [y/N]: y
โœ… Cleaned 50 entries and 10 daily files
๐Ÿ’พ Backup created for safety

Custom Time Entry

# Forgot to track? Backdate it
$ drudge start "Morning standup" --time 09:00
๐Ÿš€ Started 'Morning standup' at 2025-10-04 09:00:00

$ drudge end "Morning standup" --time 09:30
๐Ÿ Completed 'Morning standup' (Duration: 00:30:00)

Daily Reporting

# View today's summary
$ drudge daily
๐Ÿ“… Daily Summary for 2025-10-04
๐Ÿ“Š Total: 5 tasks, 7h 30m

  โ€ข Fix bug #123: 2h 30m
  โ€ข Code review: 1h 00m
  โ€ข Morning standup: 0h 30m
  โ€ข Documentation: 2h 00m
  โ€ข Backend API: 1h 30m

# View specific date
$ drudge daily --date 2025-10-03

๐Ÿ—๏ธ Architecture

Package Structure

src/worklog/
โ”œโ”€โ”€ __init__.py          # Package initialization
โ”œโ”€โ”€ __main__.py          # Entry point
โ”œโ”€โ”€ models.py            # Data models (TaskEntry, PausedTask, WorkLogData)
โ”œโ”€โ”€ config.py            # Configuration management
โ”œโ”€โ”€ validators.py        # Input validation
โ”œโ”€โ”€ managers/            # Business logic
โ”‚   โ”œโ”€โ”€ worklog.py       # Core WorkLog class
โ”‚   โ”œโ”€โ”€ backup.py        # Backup management
โ”‚   โ””โ”€โ”€ daily_file.py    # Daily file operations
โ”œโ”€โ”€ cli/                 # Command-line interface
โ”‚   โ””โ”€โ”€ commands.py      # Typer commands
โ””โ”€โ”€ utils/               # Utilities
    โ””โ”€โ”€ decorators.py    # Common decorators

Data Storage

~/.worklog/
โ”œโ”€โ”€ worklog.json         # Complete task database (JSON)
โ”œโ”€โ”€ worklog.log          # Application logs
โ”œโ”€โ”€ 2025-10-01.txt      # Human-readable daily logs
โ”œโ”€โ”€ 2025-10-02.txt
โ”œโ”€โ”€ 2025-10-03.txt
โ””โ”€โ”€ daily/              # Backup directory
    โ”œโ”€โ”€ 2025-10-01.txt
    โ””โ”€โ”€ 2025-10-02.txt

Daily File Format

2025-10-04 09:00:00 Morning standup (00:30:00)
2025-10-04 10:00:00 Fix bug #123 (02:30:00)
2025-10-04 14:00:00 Backend API [ACTIVE]
2025-10-04 15:00:00 Code review [PAUSED]

๐Ÿ”„ Version History

Version 2.1.0 (Current - October 4, 2025)

New Features:

  • โœจ Enhanced end command: --all flag to end both active and paused tasks
  • โœจ Clean command: Erase worklog entries by date, task, or all (with backups)
  • โœจ Improved help: Native Typer --help integration (removed custom help command)

Improvements:

  • ๐Ÿ”ง End command: drudge end keeps paused tasks, drudge end --all ends everything
  • ๐Ÿ›ก๏ธ Clean safety: Automatic backups, confirmation for --all, smart daily file rebuild
  • ๐Ÿ“š All 39 test cases passing

Version 2.0.2

New Features:

  • Anonymous work sessions
  • Parallel task mode
  • Optimized list command
  • Enhanced recent command

Version 2.0.1

Major Refactoring:

  • Complete architectural overhaul
  • Typer CLI framework with Rich formatting
  • Professional package structure
  • 28 comprehensive test cases

Version 1.0

  • Initial release with basic task tracking

๐Ÿงช Testing

Run Tests

# Run all tests
python3.10 -m pytest test_worklog_updated.py -v

# Run specific test class
python3.10 -m pytest test_worklog_updated.py::TestNewFeatures -v

Test Coverage

  • 39 comprehensive test cases
  • 100% pass rate on Python 3.10 and 3.13
  • Core features: Start, end, pause, resume
  • New features: Anonymous tasks, parallel mode, clean command
  • Edge cases and error handling

๐Ÿ› ๏ธ Development

Build Package

# Build distribution
python3.10 -m build

# Check distribution
twine check dist/*

Publish to PyPI

# Upload to PyPI
twine upload dist/*

๐Ÿ“„ License

MIT License - See LICENSE file for details

๐Ÿ”— Links

๐Ÿ™ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ’ฌ Support

For issues, questions, or feature requests, please open an issue on GitHub.


Built with โค๏ธ using Python, Typer, and Rich

Version 2.1.0 - Enhanced CLI with native help, powerful clean command, and improved task management

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

drudge_cli-2.1.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

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

drudge_cli-2.1.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file drudge_cli-2.1.0.tar.gz.

File metadata

  • Download URL: drudge_cli-2.1.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for drudge_cli-2.1.0.tar.gz
Algorithm Hash digest
SHA256 96bde047998165b58bf9fd39b471007eb2896c834c1e737b81124c966653582e
MD5 76d5d45e361e416fd5bef0d94a2efc39
BLAKE2b-256 cba5afc6fb449cd4e18d93eefde80c766e171ef1ad3cf92e03e2b0c00f731847

See more details on using hashes here.

Provenance

The following attestation bundles were made for drudge_cli-2.1.0.tar.gz:

Publisher: publish.yml on Trik16/drudge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drudge_cli-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: drudge_cli-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for drudge_cli-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0739a45ad5eabe1c69b1e1d4c2f73ddf714fb8f679b86a9740d1b51c2ebb26ad
MD5 a789e43f31d021bd3af50267d60eba89
BLAKE2b-256 441fedc9dddb978695e4a26f352a41ecae70c561f4525b91a5f29f9d19dce64c

See more details on using hashes here.

Provenance

The following attestation bundles were made for drudge_cli-2.1.0-py3-none-any.whl:

Publisher: publish.yml on Trik16/drudge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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