samg / timetrap

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

Renaming a sheet #63

Open faceleg opened 11 years ago

faceleg commented 11 years ago

Example:

I create the sheet "Sheet", and start tracking time. Later I want to rename it to something sane, without moving all 50 entries I've added to it individually.

Is this possible?

samg commented 11 years ago

It is possible, and pretty straight forward.

There's a good example in the "Output Formatters" section of the readme.

Basically, you can accomplish that with a tiny bit of shell scripting and the ids formatter using a command like this:

for id in `t display sheet1 -f ids`; do t edit --id $id --move sheet2; done

Also t backend will open an console to the sqlite database, so you could move the entries in batch using a query like:

update entries set sheet = "NewSheet" where sheet = "OldSheet"

This feature could be added to the timetrap core, but I've generally taken the approach of keeping the core small and simple and making it easy to script using other tools (e.g. bash).

Hope that helps. Let me know if you run into problems with it.

Cheers, ~s

faceleg commented 11 years ago

This works, thanks for the tip!

Could we have this added to a wiki or wherever suitable? I'm sure others would like to do this (and like me, may not think to script it).

samg commented 11 years ago

@faceleg - I think the wiki for this repo is publically editable. It would be great if you'd add that explanation. Thanks!

courajs commented 9 years ago

I think this is a very common action. Requiring a user to learn the scripting facilities in order to change the name of a timesheet makes the app feel more complex, not less. Would you accept a PR with good code + tests to add this command? Either t rename or t mv.

phantomwhale commented 7 years ago

Thanks for the handy bash command @samg - would be nice to see an option to rename all entries in a sheet, if anyone was keen to work on a PR (and @samg open to merging one?)

Yes, I realise that someone could be me too - for now, I'm just adding my support, but maybe in quieter times might find some time to cobble something together.