| Crates.io | markdown_timesheet |
| lib.rs | markdown_timesheet |
| version | 0.8.0 |
| created_at | 2025-09-04 16:12:19.389599+00 |
| updated_at | 2025-09-09 20:15:55.445697+00 |
| description | A tool for processing markdown files to extract and format timesheet data |
| homepage | https://github.com/rickprice/MarkdownTimeSheets |
| repository | https://github.com/rickprice/MarkdownTimeSheets |
| max_upload_size | |
| id | 1824475 |
| size | 61,183 |
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
# Status bar summary (compact output for current day/week)
cargo run -- --summarize
# Status bar with custom weekly hours
cargo run -- --summarize --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)--summarize: Show compact current day and week summary for status bar--debug: Show detailed debug information and error locations--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:00Started working at 8:30Stop work 17:30Stopped working at 16:45Work time 2 hours project workWork time 30 minutes meetingWork time 1 hour documentationWork time 90 minutes code reviewStat holiday or Statutory holidayPTOHoliday daycargo build --releasetarget/release/markdown_timesheetDaily 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.
When using the --summarize flag, the tool outputs a compact single-line format perfect for status bars:
Today: 5h 30m * | Week: 32h 15m (7.8h short)
*: Tentative time (current incomplete session still running)E!: Error flag (incomplete or orphaned time entries)(X.Xh short): Hours remaining to meet weekly target# Normal completed day
Today: 8h 00m | Week: 40h 00m
# Day with tentative time (currently working)
Today: 5h 30m * | Week: 32h 15m (7.8h short)
# Day with errors (incomplete entries)
Today: 3h 45m E! | Week: 25h 30m (14.5h short)
# No data available
Today: No data | Week: No data
# Week target exceeded
Today: 9h 15m | Week: 42h 30m
Run tests with:
cargo test
The codebase follows Rust best practices and passes all quality checks with zero warnings:
# Run clippy for linting (strict mode with pedantic checks)
cargo clippy -- -D warnings -D clippy::all -D clippy::pedantic
# Run tests (42 tests, all passing)
cargo test
# Build optimized release
cargo build --release
The code is optimized for maximum performance:
filter_map() and sum() for optimal processing&[T]) instead of owned vectors where possiblesort_unstable_by_key() for better performance than stable sortingThe code is optimized for performance and follows canonical Rust patterns:
filter_map() and sum() for efficiencysort_unstable_by_key() for better performance than stable sorting