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

Some minor alteration concerning .zshrc.pre-oh-my-zsh #2499

Closed
greenwellness opened this issue Feb 5, 2014 · 8 comments
Closed

Some minor alteration concerning .zshrc.pre-oh-my-zsh #2499

greenwellness opened this issue Feb 5, 2014 · 8 comments
Labels
Area: installer Issue or PR related to the installer Feature New feature or request

Comments

@greenwellness
Copy link

A suggestion, but would it be possible to copy the existing .zshrc file to .zshrc.pre-oh-my-zsh-$(date +%s) or the likes? I had a hanging install on password, had to kill it, then tried to install again and - of course - it overwrites my previous (correct) .zshrc file.

Obviously, I should have backed it up - and its not that great of a loss, but still. Don't know if this is desirable or if people fear it might clutter up ~ a bit too much on the .zfiles potentially.

@ncanceill
Copy link
Contributor

Probably no need for a timestamp, just a counter like .zshrc.pre-oh-my-zsh.1.

In order to mitigate the side-effect of cluttering ~ a bit, this could be limited to something around 5 copies.

Let's see what the community thinks before PR.

@mcornella
Copy link
Member

We could just use interactive mv to move the zshrc file, which asks the user before overwritting the destination file.

@robbyrussell robbyrussell added the Feature New feature or request label Feb 22, 2015
@ncanceill
Copy link
Contributor

I like this solution with mv -i. Anyone care to submit a PR?

@apjanke
Copy link
Contributor

apjanke commented Jun 25, 2015

I like this idea, but think the timestamped/countered copies might be better than mv -i. A user who hits the interactive mv -i prompt might not know the significance of what it's asking until too late. (E.g. a new user might not know that OMZ moves and replaces .zshrc, and that the pre-oh-my-zsh one is their original, and the effect depends on how many times OMZ has been installed.) And then if you answer no, you have to abort the install, manually back up your .zshrc, and restart the installation.

We probably don't need to worry much about cluttering up ~ with the backup files. Most users won't be installing OMZ many times. And we can use diff to avoid creating redundant copies: IIRC, the new .zshrc created by OMZ's installer is exactly the same each time, so you'd only have multiple backup files where there were significant user-generated changes, which I think you'd want to preserve.

IMHO, avoiding destructive changes to user data should be a high priority, and worth some clutter to make it less likely to happen.

@apjanke
Copy link
Contributor

apjanke commented Sep 23, 2015

I went and made a PR for this: #4391.

@mcornella mcornella added the Area: installer Issue or PR related to the installer label May 12, 2016
@leoj3n
Copy link
Contributor

leoj3n commented Aug 18, 2016

Another option to consider is displaying an error message telling the user to resolve the conflict by hand along the lines of "Move the conflicting filename away and try again".

Either way, the user is either going to have to deal with the fact that there are multiple backups when uninstalling, or they will have to deal with the conflict upfront. I think dealing with the conflict up front is less confusing.

@mcornella
Copy link
Member

mcornella commented May 28, 2019

I pulled @apjanke's solution in #5169, which is now ready for testing.

If you want to help speed up the testing and merge (which should happen early next week), you can wget or curl it from the URL https://raw.githubusercontent.com/mcornella/oh-my-zsh/refactor-installer/tools/install.sh. Read the comments at the top of the script to know how to call it.

Thanks!

@mcornella
Copy link
Member

Closed by #5169.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: installer Issue or PR related to the installer Feature New feature or request
Projects
None yet
5 participants