Crates.io | markdown_timesheet |
lib.rs | markdown_timesheet |
version | 0.6.0 |
created_at | 2025-09-04 16:12:19.389599+00 |
updated_at | 2025-09-06 20:56:08.274744+00 |
description | A tool for processing markdown files to extract and format timesheet data |
homepage | |
repository | |
max_upload_size | |
id | 1824475 |
size | 42,035 |
A command-line tool for parsing time tracking data from markdown files and generating daily, weekly, and monthly summaries with configurable weekly hour targets and shortage tracking.
This tool parses markdown files containing time entries in natural language format and calculates total hours worked per day, week, and month. It's designed to work with simple markdown files where you log your work start/stop times, direct work time entries, and holidays. The tool can track weekly hour shortages against configurable targets.
Run the tool on a directory containing markdown files named in YYYY-MM-DD.md
format:
# Basic usage (scans current directory, 40-hour weeks)
cargo run
# Specify directory
cargo run /path/to/timesheets
# Set custom weekly hours target
cargo run --weekly-hours 37.5
# Combined options
cargo run /path/to/timesheets --weekly-hours 35
# Show help
cargo run -- --help
directory
: Directory containing markdown timesheet files (default: current directory)--weekly-hours HOURS
: Expected weekly work hours for shortage calculation (default: 40)--help
, -h
: Show usage informationCreate markdown files with names like 2025-08-25.md
containing time entries:
# Daily Notes
Start work 9:00
Had a productive morning working on the project.
Stop work 12:00
Lunch break
Start work 13:00
Afternoon session focused on testing.
Stop work 17:30
# Alternative: Direct time logging
Work time 2 hours code review
Work time 30 minutes documentation
# Holiday/PTO examples
Stat holiday
PTO
Holiday day
The parser recognizes these patterns (case insensitive):
Start work 9:00
Started working at 8:30
Stop work 17:30
Stopped working at 16:45
Work time 2 hours project work
Work time 30 minutes meeting
Work time 1 hour documentation
Work time 90 minutes code review
Stat holiday
or Statutory holiday
PTO
Holiday day
cargo build --release
target/release/markdown_timesheet
Daily Summary (Last 2 Weeks):
==============================
2025-08-25 Mon - 8h 30m
2025-08-26 Tue - 7h 00m
2025-08-27 Wed - 6h 15m
2025-08-28 Thu - 8h 00m
2025-08-29 Fri - 4h 15m
Monthly Summary:
================
August 2025: 156h 45m
September 2025: 42h 30m
Weekly Summary:
===============
Week of 2025-08-25 - 2025-08-31: 34h 00m [6h 00m short]
Week of 2025-09-01 - 2025-09-07: 42h 30m
The weekly summary shows shortages when using the default 40-hour target. Weeks that meet or exceed the target show no shortage indicator.
Run tests with:
cargo test
The codebase follows Rust best practices and passes all quality checks:
# Run clippy for linting
cargo clippy -- -D warnings
# Run tests
cargo test
# Build optimized release
cargo build --release
The code is optimized for performance and follows canonical Rust patterns:
sum()
and map()
for efficiencysort_unstable_by_key
for better performanceunwrap()
calls