dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
679 stars 75 forks source link

Idea: Simplify record keys #116

Closed FelixTheodor closed 2 years ago

FelixTheodor commented 3 years ago

Currently, the only way to reference a record is its key: the specific time it has been started. This is laborious to write down number by number, or you need to copy paste it every time. We already have the latest alias, but maybe we could simplify this even more by letting the user reference a record of the current day by entering its "ID", that is already created on the fly via

timetrace list records today
+-----+------------------+-----------+---------+-----------+------------+
|  #  |       KEY        |  PROJECT  |  START  |    END    |  BILLABLE  |
+-----+------------------+-----------+---------+-----------+------------+
|   1 | 2021-06-11-12-52 | test1     | 12:52   | 12:55     | no         |
|   2 | 2021-06-11-12-51 | test3     | 12:51   | 12:53     | no         |
|   3 | 2021-06-11-12-49 | test2     | 12:49   | 12:51     | no         |
|   4 | 2021-06-11-12-48 | test1     | 12:48   | 12:49     | no         |
+-----+------------------+-----------+---------+-----------+------------+

I imagine it like this:

timetrace edit record #1 -p 5m

dominikbraun commented 3 years ago

I had the exact same idea in mind since copying the record key can be a bit tedious.

The only concern I have is that if you list the records, stop tracking and start again and then edit a record based on the output of list records, the edited record will be a different one. Same goes for repeating an edit record command if a new record has been created in the meantime.

The solution to this problem could be to numerate the records with a descending index (oldest is #1).

FelixTheodor commented 3 years ago

Ah, nice! Yes, I see your point. Would you say 'to reverse the numeration of the records' should be handled as an own issue, or shall we keep both in this one, since they are closely related? Either way, I have some spare time this weekend and would like to work on the feature :)

FelixTheodor commented 3 years ago

Okay, since the reverse of the records is (as it seems) just a one-line-change, I guess we don't need a special issue for it - unless you know of some other parts of the code that rely on the numeration.

dominikbraun commented 3 years ago

Yap, the numeration can be changed as a part of that issue.