samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.48k stars 116 forks source link

Merging two timesheets #188

Closed richardazia closed 3 years ago

richardazia commented 3 years ago

I accidentally created two sheets with similar names. I would like to be able to merge them.

The command could be: t merge sheet 1a sheet 1 The expected behaviour: take the data from sheet 1a and place it in sheet 1. It would then delete sheet 1a as it is no longer needed.

Would anyone else find this useful?

richardazia commented 3 years ago

I accidentally created two sheets with similar names. I would like to be able to merge them.

The command could be: t merge sheet 1a sheet 1 The expected behaviour: take the data from sheet 1a and place it in sheet 1. It would then delete sheet 1a as it is no longer needed.

Would anyone else find this useful?

I used SQLite studio 3.2.1 to fix the mistake.

jerith666 commented 3 years ago

I usually use t edit --move to fix mistakes like this. It doesn't scale if the accidentally-created sheet ends up with more than a few entries though.

richardazia commented 3 years ago

I just tried t edit --move both ways to see how it works. Next time I make such a mistake I will use this. Thanks.

samg commented 3 years ago

There's also an example in the README of how to use the ids formatter to script this kind of move between sheets.

https://github.com/samg/timetrap#built-in-formatters

The ids formatter is provided to facilitate scripting within timetrap. It only outputs numeric id for the entries. This is handy if you want to move all entries from one sheet to another sheet. You could do something like this:

$ for id in `t display sheet1 -f ids`; do t edit --id $id --move sheet2; done
editing entry #36
editing entry #37
editing entry #44
editing entry #46