timetrace icon indicating copy to clipboard operation
timetrace copied to clipboard

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

Open joshuaherrera opened this issue 3 years ago • 7 comments

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.

joshuaherrera avatar May 26 '21 06:05 joshuaherrera

Good point, thanks. There are two solutions:

  • Automatically rename the file to the key after editing the record.
  • Introduce a --rename flag explicitly for renaming projects and changing the filename there.

@aligator PTAL

dominikbraun avatar May 26 '21 06:05 dominikbraun

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.

sfrique avatar Jun 11 '21 20:06 sfrique

@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?

joshuaherrera avatar Jun 14 '21 21:06 joshuaherrera

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?

dominikbraun avatar Jun 15 '21 05:06 dominikbraun

  • Could we add something like an "index" file for each project where all files are listed that are part of the project?
  • It would be easier if the files would use an ID instead of the project name.

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

aligator avatar Jun 15 '21 11:06 aligator

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 avatar Jun 15 '21 11:06 dominikbraun

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.

dominikbraun avatar Jul 04 '21 21:07 dominikbraun