Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make accidental removal harder #3803

Closed
coz-eduardo-hernandez opened this issue Jun 8, 2024 · 0 comments · Fixed by #3804
Closed

Make accidental removal harder #3803

coz-eduardo-hernandez opened this issue Jun 8, 2024 · 0 comments · Fixed by #3804
Labels
enhancement New feature or request

Comments

@coz-eduardo-hernandez
Copy link

coz-eduardo-hernandez commented Jun 8, 2024

Is your feature request related to a problem? Please describe.

I tried to add a directory to see how well it would be handled. The files had many subdirectories and files, and I was using Windows Powershell, so at one point it failed because the path was too long, so adding failed

I edited a file, and I got a bunch of warnings related to carriage returns due to the files that did get added before failing. I looked up which command would remove the files from chezmoi, so I typed 'chezmoi remove '

Voici the accidentally removed files

There was no path display, warning or prompt. I did not use the --force flag. In fact, since I have autoPush = true, the only output described pushing the .chezmoiignore file which confused me for a moment since my input did not have that file included, but I figured that chezmoi detected the file had been edited externally and pushed even if my command had nothing to do with that file. The only other option I have set is my editor

In the other issues I read at #3610 and #3182, multiple failsafes are mentioned, but I didn't get any safety net. I also read mentions of a .chezmoiremove file, but I don't have that file either

Describe the solution you'd like. Describes what alternatives you have considered

Before testing, I read the Quick Start and User Guide. I do not recall any mention of file removal or the remove / purge / forget commands in them. I'd add to the User Guide section Daily Operations a subject related to file removal and the three commands

I understand that remove was modelled after rm, but I'm not sure that following it closely was the best idea:

  • There is no 'add' in a shell, but that's ok because a dotfile manager is not a shell. If you look at this through the language, remove is the antonym of add, but functionally the opposite of the add command is the forget command, so it can be expected that intuitively users will think remove will leave the source file intact and will only remove the file from chezmoi
  • Given that almost everything in chezmoi and the website is so well done, and chezmoi essentially creates backups, users can be lured into quickly trusting the tool. The dangers of rm are legendary, but I don't think that infamy is something chezmoi strives to replicate. I don't think the people who got burnt by remove are dumb
  • One of the issues suggested changing the name of remove to remove-permanently. A rename sounds a reasonable though I'd prefer something that refers more to how it deletes both the source and the destination, since that is the actual function, maybe full-remove ?
  • If this problem is ignored, more people will accidentally delete their files then create an issue about it. If anything, making it harder to unintentionally remove will reduce the issues that need a reply
  • I do understand many users are used to remove, but improving usability is just a growing pain for a widely-used tool

So I have three suggestions:

  • Add remove/purge/forget to the User Guide
  • Change remove to full-remove
  • Seal whatever usability hole allowed me to use remove without feedback from the tool

Additional context

Console output of remove
chezmoi

@coz-eduardo-hernandez coz-eduardo-hernandez added the enhancement New feature or request label Jun 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant