PicoJr/rtw

add longer "description" field

Closed this issue · 4 comments

In git, when you include a commit message, you can have a one line summary/title, as well as a longer description/explanation. I think rtw would benefit from a similar approach.

Currently when I write a title for an activity in rtw, I make it as short as possible, ideally one word, otherwise it may be difficult to read / unattractive when displayed in a timeline. For example, when I first started using rtw, I described activities like "clean kitchen + make tea", but the words would get chopped up into multiple lines or otherwise mangled, so now I just write "tea". This shorthand is still understandable to me, but some information is lost (perhaps sometimes when I make tea the kitchen is already clean, as unlikely as that sounds).

If I was e.g. writing code as an activity, it might be beneficial to me to keep a journal of what I was working on, with more detail than a word or two. For example, let's say my activity was "debug rtw", but I didn't have enough success to write a code commit or patch that would appear in the repository. Perhaps I would want to explain in my time tracking exactly what I was trying to debug, what challenges I faced / why I didn't make concrete progress (perhaps yak shaving occurred).

You could add a flag such as -m to add a longer description, in addition to the usual title.

You could also implement editor support as git does, so that I could drop into vim/emacs/nano/micro to write a journal entry. Perhaps if I input e.g. rtw track with no further arguments, it could drop into editor mode. The timing is tricky, however. I would expect it to be difficult to write a useful description before you've actually done a task, as with rtw start. And it's nice to be able to write rtw stop when the activity is done without further arguments (when you're only tracking one activity), without an editor appearing.

It might be good to be able to add another command to edit or append to a journal entry, so that you could say some things when you start an activity, provide some updates when you finish, and maybe even some retrospective "in hindsight" comments at a later date.

It would also be good to add some display mode that makes it easy to read descriptions / journal entries. Perhaps rtw log, to parallel git.

You could add a flag such as -m to add a longer description, in addition to the usual title.

Adding this feature shouldn't be too difficult.

However I need to be careful with backward compatibility: adding a new description field will change what is written inside the json and what rtw expects to find in it.

I'll find a solution to that.

Note: It might not scale very well if many activities with long descriptions are stored inside a json file. I should provide an easy way to keep the json file small enough. e.g. rtw split 2 months ago would save all activities that are older than <date> = today -2 months to a file rtwh.<first_date>_<date>.json and keep activities that are more recent than that in rtwh.json.

It would also be good to add some display mode that makes it easy to read descriptions / journal entries.
Perhaps rtw log, to parallel git

Yes, you are right, once rtw stores descriptions it makes sense to be able to retrieve that information =)

I might add a new option to summary instead of creating a new log subcommand though.

You could also implement editor support as git does

Why not, I could implement that later, running rtw track 9 - 10 breakfast -m (no arguments after -m)
would open an editor ($EDITOR), saving would write down content to /tmp/<randomid>, the content would be used to fill out the description field; exiting without saving would cancel the creation of the activity.

@skyfaller it's still a work in progress but it's coming together

it's backward compatible but not the other way around: files generated by rtw on branch feat-description cannot be used by older rtw versions.

rtw track 9 - 10 breakfast -d "I ate delicious pancakes"
rtw summary -d

output:

breakfast 2020-07-11T09:00:00 2020-07-11T10:00:00 01:00:00
I ate delicious pancakes

description are used when exporting to calendar:

rtw dump
BEGIN:VCALENDAR
VERSION:2.0
PRODID:ICALENDAR-RS
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20200712T114145Z
DESCRIPTION:I ate delicious pancakes
DTEND:20200712T080000
DTSTART:20200712T070000
SUMMARY:breakfast
UID:6d2f4c54-6477-4c4a-b8d5-7360eef2a15b
END:VEVENT
END:VCALENDAR

long description were merged in 2.0.0, for usage see commands.md

I'm closing this since it is available in 2.0.0.

It does not have an editor support like git has right now but it should be discussed in a separate issue.