masukomi / hey_3

Hey! An Interruption and Time Tracking Command line app.
https://interrupttracker.com/
Other
11 stars 2 forks source link

ability to rename project #8

Open masukomi opened 1 year ago

masukomi commented 1 year ago

proposed interface

hey rename project <old name> <new name>

Behind the scenes this would just need to do a

UPDATE projects SET name = 'new-name' 
WHERE name = 'old-name`;

Project names should be unique, and can't be "archived", so this change should be safe without other constraints.

maddy020 commented 1 year ago

Please assign this issue to me

masukomi commented 1 year ago

All yours maddy. Thanks for pitching in! :D

Please note that main is slightly ahead of the official release. I just haven't released the new stuff because of this fez bug. Until i get that resolved new changes won't be pushed to fez. :/

masukomi commented 1 year ago

Just to be explicit. I don't think there needs to be a check if the "new name" already exists, but 🤔 I wonder if there should be a check with the user. Something like "Hey, [new name] already exists. Do you want to merge [old name]'s records into it?"

masukomi commented 1 year ago

Damn. just realized that if the target name exists then you have to repoint all the entity_project to the new project id, and then delete the old project.

I was planning on "merge projects" as a separate ticket, but i think they're ultimately the same thing @maddy020.

Sorry that the complexity of this one is growing. If you just want to do a tiny PR that only renames IF the target name isn't already used I'd be fine with that. I can handle the merge stuff separately.

masukomi commented 1 year ago

You still planning on poking this @maddy020 ?

maddy020 commented 1 year ago

Ohh @masukomi Forgot about this issue I got busy in other tasks Can you please tell me in which file this change is required

codesections commented 1 year ago

Project names should be unique, and can't be "archived",

Should the fix for this issue also add a hey remove project <name> command as well? This would help declutter the output of hey projects when a user no longer cares about a project. It would also make tab-completion more helpful (once #23 is implemented).

edit: Or maybe the command would be hey kill project <name> for consistency with hey kill <name> and hey kill timer <id> ?

masukomi commented 1 year ago

Sorry been heads down in job-hunt land and accidentally removed "check github notifications" from the main part of my daily checklist... and thus kept forgetting to check 🤦‍♀️

i like hey kill <thing> <identifier> but it introduces other concerns and additional complications. I've documented my thoughts in a project specific version in Issue #34

(now to tackle the open PRs... ;) )

cc @codesections

masukomi commented 1 year ago

@maddy020 if you're still interested it'd prolly just be a change to the bin/hey for the command and lib/Hey/Project.rakumod for the actual behavior.