{"id":18099596,"url":"https://github.com/barafael/trk","last_synced_at":"2025-09-04T19:50:03.720Z","repository":{"id":46785993,"uuid":"85570082","full_name":"barafael/trk","owner":"barafael","description":"Make time sheets with git integration.","archived":false,"fork":false,"pushed_at":"2023-07-07T15:13:33.000Z","size":264,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-01T03:09:20.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barafael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-03-20T11:41:33.000Z","updated_at":"2023-11-13T21:56:54.000Z","dependencies_parsed_at":"2025-04-13T15:56:42.284Z","dependency_job_id":"0d0fc1d2-edc4-4274-af4e-d9a81c184e20","html_url":"https://github.com/barafael/trk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/barafael/trk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barafael%2Ftrk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barafael%2Ftrk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barafael%2Ftrk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barafael%2Ftrk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barafael","download_url":"https://codeload.github.com/barafael/trk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barafael%2Ftrk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273666013,"owners_count":25146275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-31T21:10:10.786Z","updated_at":"2025-09-04T19:49:58.698Z","avatar_url":"https://github.com/barafael.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trk\nTrack time with annotated pauses, notes, and git commits. It is meant to run in a git directory but can run without it. When running in a git directory, commits are automatically added to the time sheet. `trk` will generate a html report.\n\nA `trk` timesheet is a sequence of sessions, which contain events in the order they were added. A timesheet is created by `trk init`. A session can start with `trk begin` and ends with `trk end`. Pauses can be handled in a running session by `trk pause` and `trk resume`. Notes can be added by `trk note \u003cnote\u003e`. For status output, say `trk status {sheet|session}`. To open the html report in the default browser: `trk report {sheet|session}`. `trk help` will list all possible commands.\n\nAn example:\n\n```\n10:00 $\u003e trk init # do this once\nInit successful.\n\n10:00 $\u003e trk begin\n\n10:01 $\u003e trk note 'blablabla'\n\n10:11 $\u003e trk pause\n\n10:12 $\u003e trk note \"coffee\" # automatically added as note on the pause\n\n10:15 $\u003e trk resume\n\n18:00 $\u003e trk end\n\n```\n\n```json\n{\n  \"end\": 1491549156,\n  \"sessions\": [\n    {\n      \"end\": 1491549238,\n      \"events\": [\n        {\n          \"Note\": {\n            \"text\": \"blablabla\",\n            \"time\": 1491549186\n          }\n        },\n        {\n          \"Pause\": {\n            \"note\": \"coffee\",\n            \"time\": 1491549190\n          }\n        },\n        {\n          \"Resume\": {\n            \"time\": 1491549212\n          }\n        }\n      ],\n      \"running\": false,\n      \"start\": 1491549174\n    }\n  ],\n  \"start\": 1491549157,\n  \"user\": \"Rafael Bachmann\"\n}\n```\n\nTurns into something like this:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"\u003e\n  \u003ctitle\u003eTimesheet for Rafael Bachmann\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003csection class=\"session\"\u003e\n    \u003ch1 class=\"sessionheader\"\u003eSession on 2017-04-07, 09:12:54\u003c/h1\u003e\n    \u003cdiv class=\"entry note\"\u003e\n      2017-04-07, 09:13:06: Note: blablabla\n    \u003c/div\u003e\n    \u003cdiv class=\"entry pause\"\u003e\n      2017-04-07, 09:13:10: Started a pause\n      \u003cp class=\"pausenote\"\u003ecoffee\u003c/p\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"entry resume\"\u003e\n      2017-04-07, 09:13:32: Resumed work\n    \u003c/div\u003e\n    \u003ch2 class=\"sessionfooter\"\u003eEnded on 2017-04-07, 09:13:58\u003c/h2\u003e\n  \u003c/section\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nWhich can be styled by style.css:\n\n![sheet.png](https://github.com/medium-endian/trk/blob/master/sheet.png)\n\n## Installation\n\nCurrently the best way to install this is to install rust nightly via rustup.rs, clone this repo and then run `cargo build --release` in it.\n\nYou might want to add `/home/rafael/Code/trk/target/release` to your `$PATH` to have the `trk` executable available.\nFor development, you might want to add `/home/rafael/Code/trk/target/debug` to your `$PATH` (in that case build with `cargo build`).\nYou could also install properly to `~/bin/` or something.\n\nIf you use `trk` together with `git`, it is recommended that you place `/.trk/` in your .gitignore file. `trk` will place a `.git` directory in `.trk` just to track itself, also you probably don't want to directly check in the `trk` internal files.\n\nTo automatically add abbreviated git commits or branch summaries to the history, you can copy the files `post-commit` (for commits) or `post-checkout` (for branches) to your projects `.git/hooks` directory. If those files already exist, just append the lines from the appropriate hook. All the hooks do is call `trk` with some meta info.\n\n## Soft Dependencies\n\n`trk` is useful together with `html-tidy` and `git`, but it also works without them. (At the moment `trk` complains a lot if html-tidy is installled even though html-tidy is not at all necessary for the program to work correctly). When you run without git (or rather without `user.name` set in `.gitconfig`) you have to provide one as in `trk init \u003cname\u003e`.\n\n## TODO:\n- [x] Rename ev_type to ty\n- [x] Naming improvements: is\\_valid\\_ts, timestamp, time\n- [x] Remove trailing \\_opt from options which are de-opted anyway. Just rebind the names\n- [x] Find out if `use util::*;` and similar is bad\n- [x] Move `extern crate`s to root and reorder `extern crate` and `use`'s and `mod`s\n- [x] Check if clap code should be put in a yaml file (not for now)\n- [x] Simplify operations on session vec (last(), last_mut())\n- [ ] Redesign timesheet to handle timestamps nicely and deduplicate all timestamp logic\n- [ ] Clarify when ts + 1 is used (preferably improve logic so it becomes unnecessary)\n- [x] Simplify option handling with `if let`, `map`, `map_or`\n- [x] Multiple imports\n- [x] Add work/pause summary to status output\n- [x] Add settings/config struct\n- [x] Split up into timesheet.rs into session.rs, timesheet.rs, traits.rs, and util.rs\n- [ ] Move HTML templating to own lib or better use a crate like Maud\n- [ ] Use Result instead of bools (with error enums?)\n- [ ] Use `format!` instead of `write!` with `String::new()` WIP\n- [ ] Check output of `get_seconds()` anyway\n- [x] Include stylesheets and gitignore in binary\n- [ ] Include Commit hooks in binary\n- [x] Fix underflow in session.rs work_time()\n- [x] Set the current directory to the next higher directory which contains a `.trk` directory\n- [x] Set the current directory correctly even if started from within a .trk directory\n- [ ] Support different natural language durations (one week, since=date, or maybe place pins...)\n- [x] Add a 'set' command, for example to set git_repo_url (in order to make the commit messages links to the repo)\n- [x] Flush to html every load and just open browser on report.\n- [x] Format output - leave out commits and branches, for example\n- [x] Improve status output (was just debug output)\n- [x] Better reporting if file is not present xor corrupt\n- [x] Add past event adding for begin and end\n- [x] Find a way to query time sheets up to a point in the past\n- [x] Open a new session if a commit or branch is pushed when no session is running. \n- [x] Convert unix timestamps to date strings\n- [x] The session struct is a list of sequential events with timestamps. A session struct is identified by it's starting time\n- [x] The Timesheet struct is deserialized on every run, worked on, and then serialized again. It has a to_html() implementation.\n- [ ] nicetohave: Run this on a server instead of the local machine.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarafael%2Ftrk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarafael%2Ftrk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarafael%2Ftrk/lists"}