dominikbraun / timetrace

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

command `timetrace edit project <key>` does not rename file #81

Open joshuaherrera opened 3 years ago

joshuaherrera commented 3 years ago

Currently, when a user edits a project using timetrace edit project <key> the text editor is opened so the user can change the key. It seems to me that any subsequent calls to this command should reference the new key, but trying to run this command this way causes the file to not be found. editproj Since some functions like project.LoadProject assume that the key will be part of the path, it seems like this command should also rename the json file with the new key.

dominikbraun commented 3 years ago

Good point, thanks. There are two solutions:

@aligator PTAL

sfrique commented 3 years ago

I also see that It does not update old records.

What I expected when I renamed a project, everything else would be renamed to use that new project, but when I list old records, It does still show old project name.

joshuaherrera commented 3 years ago

@dominikbraun I'd like to handle this issue, can you assign this to me?

Also, can you think of a more optimal way of renaming the projects on the records, aside from looping through each date folder and .json file?

dominikbraun commented 3 years ago

Also, can you think of a more optimal way of renaming the projects on the records, aside from looping through each date folder and .json file?

Unfortunately not... 🤔 @aligator?

aligator commented 3 years ago

Was your intention that the files are human readable? Or doesn't that matter?

dominikbraun commented 3 years ago

Was your intention that the files are human readable? Or doesn't that matter?

If I'm not missing something, it doesn't really matter. My suggestion would be to implement it as @joshuaherrera said, find a well-designed solution in the meantime and then migrate to that solution in a later release.

dominikbraun commented 3 years ago

My suggestion would be to implement it as @joshuaherrera said, find a well-designed solution in the meantime and then migrate to that solution in a later release.

So my solution to this can be found in #156.