nikolassv / bartib

A simple timetracker for the command line. It saves a log of all tracked activities as a plaintext file and allows you to create flexible reports.
GNU General Public License v3.0
670 stars 35 forks source link

Collab #50

Closed simonsan closed 7 months ago

simonsan commented 7 months ago

Hey there, bartib inspired me to build https://github.com/pace-rs/pace because I felt my use case for tracking work and break times is not fulfilled by a lot of tools out there. I do see that you also spend a lot of time thinking about time management techniques. Earlier, you said you consider bartib to be feature-complete so I started implementing pace based on my own ideas and inspirational things from bartib, timetracking, vayu and work-break.

Doing the same work should be discouraged. Working together should be applauded.

Based on that, I wanted to ask if you feel - despite your work on bartib - like joining the cause and help to implement pace. :) There is a discord link in the repository, if you want to discuss further, would be happy to see you there.

Cheers, Simon

nikolassv commented 7 months ago

Thank you for bringing this project to my attention and the invitation to collaborate! This looks very promising and surely fills a gap those who do like to have more features in their time tracking than bartib can offer. I am unsure, whether I will be able to put much time into this, but I will have a look at it.

simonsan commented 6 months ago

I want to compliment you for the cleanliness of the layout of your report, something I didn't feel like wanting to spend too much time in (I saw you wrote a couple of LOC for that).

In pace I did it now like this with tabled, if you ever feel like contributing a better style 😬 ... 😅

2024-03-08 02_14_31-activity_tracker rs (Working Tree) (activity_tracker rs) - pace - Rust Dev - VSC

One idea I want to follow up on is the reporting, as I want to minimize the effort on the review layout, I feel it's nice to ramp up effort on html templating, so people can create their own templates and pace fills it out. That might be great for billing templates etc.

nikolassv commented 6 months ago

yes, getting the report was quite a lot of work. When I wrote most of it, I also looked around for some existing table crates, but they either did not fulfill all my needs or they were too bloated for a simple cli application. That's why I decided to write my own solution. Surprisingly, the hardest part was getting word breaks right. I never assumed it would be so complicated. Eventually, I used textwrap which does a nice job.

Formatting tables always comes with some edge cases that are imposible to get right, like a terminal width smaller than 10. Luckily, they rarely occur in real life, and I assume whoever uses such a narrow terminal has other problems than a suboptimal bartib report. You just have to decide which edge cases you support and which you ignore.

Something that really bothers me is that I was never able to accurately test bartib with non-latin charsets. I would like to know if the report is at least usable with chinese, korean or arabic letters.

I like the idea of giving people the possibility to use their own templates. That would help integrating it in other workflows. For bartib, I still like the Idea of machine readable output (like suggested in this issue: https://github.com/nikolassv/bartib/issues/21). Then you could pipe the output of bartib to some templating script. Unfortunately, this is not as simple to implement, as one would think, as in bartib as of today there is no real seperate viewing layer. I hope I would someday find the time to implement it.

simonsan commented 6 months ago

I like the idea of giving people the possibility to use their own templates. That would help integrating it in other workflows. For bartib, I still like the Idea of machine readable output (like suggested in this issue: #21). Then you could pipe the output of bartib to some templating script. Unfortunately, this is not as simple to implement, as one would think, as in bartib as of today there is no real seperate viewing layer. I hope I would someday find the time to implement it.

Yes, I had the machine-readable output in mind, when I was writing the code from the beginning on, so I did it in the way, that pace is able to show/export the activity report in json and other formats. I think HTML, Markdown, (and maybe even Plaintext, although that could be an export of the CLI output, like printing the output of Display to a file) will involve the templating engine. So I wonder if you couldn't shove everything in one struct as a ReviewSummary and serialize that as json for that issue, that you linked? Or how do you mean the part with the viewing layer?

For sparing the effort to use a custom activity log format, I chose toml as for the config. So it's still being able to be edited in a text editor, but also easily parsable. Also, it can function as an offline copy of stored activities, that can be synced at a later date, e.g. when working offline in an airplane.

This is how an activity with tags and an ended intermission looks like currently. I want to add an optional billable field that contains a struct for billing information, like hourly wage etc. so people can also create bills in their templates.

[01HQXSQ6J231Q50MDPKGQ83CV9]
category = "Developer::Pace"
description = "Explain Piratricia pace"
begin = "2024-03-01T23:59:59"
end = "2024-03-02T16:07:55"
duration = 58076
kind = "activity"
tags = ["dev", "bla"]
status = "ended"

[01HQZRMCXDQZXDKTZSAFKW1JN0]
category = "Developer::Pace"
description = "Explain Piratricia pace"
begin = "2024-03-02T15:21:04"
end = "2024-03-02T16:06:52"
duration = 2748
kind = "intermission"
parent-id = "01HQXSQ6J231Q50MDPKGQ83CV9"
status = "ended"

These entries get then parsed into a BTreeMap<ActivityGuid, Activity> so they can be easily referenced by their GUID, for example. Works like a file based database, as I want to adopt SQLite storage as well to write a pace-server that people can self-host and track activities from all their devices with a tiny GUI.