-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add -configs mode. #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for writing this feature! I've been looking forward to having this functionality for a bit and haven't had time to write it myself.
Overall, great work. A few changes/ideas I had and I'll merge this in.
- Can you indent with tabs instead of spaces to match up with the style of the source?
- You should add backing up the configs in the
backup_all()
function. - I have a
_copy_file()
function implemented already, calledcopy_dotfile()
. You could refactor that to use just one method. I like the_copy_file
name change, so def keep that. - I have a
_copy_folder()
method calledcopy_dotfolder()
. Maybe update the name of my method to_copy_folder()
and use that to do what you need. - Let's update the
-reinstall
flag, and all references to it, to be-reinstall_packages
because there is now a distinction that needs to be made. - A nice usability thing would be adding
--help
to the list of click help options.
Can you take care of these?
…file and add -reinstall_configs mode.
4f8f2ac
to
50a2963
Compare
…l. Add --help to help options.
Hey, thanks for the feedback, I appreciate it (: I introduced the new copy methods in order to refactor the old ones and make their names more appropriate for the "new" purpose of being generic functions. I find the
I have now implemented all your ideas/change requests, besides the BTW, I guess my IDE auto formatted the code and introduced the indentation issue, because I was actually careful to not add a different indentation style. |
(This got a lot longer than I was expecting, but I think being thorough is important.)
Yep, let's walk through this method.
Right, this was for a feature to back up macOS Preferences Let's remove that first condition and rename some vars, so it now looks like this: def copy_dir(dir, backup_path):
"""
Copy directory from $HOME.
"""
invalid = {".Trash", ".npm", ".cache", ".rvm"}
if len(invalid.intersection(set(dir.split("/")))) == 0:
command = ""
if "Application\ Support" not in dir:
command = "cp -aRp " + dir + " " + backup_path + "/" + dotfolder.split("/")[-2]
elif "Sublime" in dir:
command = "cp -aRp " + dir + " " + backup_path + "/" + dotfolder.split("/")[-3]
sp.run(command, shell=True, stdout=sp.PIPE)
To the best of my memory, yes. But there might be some other cases covered by the
That's my mistake. The path for my machine should definitely not be hardcoded in... Thanks for offering to fix that. Here's the code block that will need to be modified (and also any other references to hardcoded paths.) # Sublime Text Configs
if os.path.isdir("/Users/alichtman/Library/Application Support/Sublime\ Text\ 2"):
dotfolders_mp_in.append((os.path.join(home_path, "Library/Application\ Support/Sublime\ Text\ 2/Packages/User"), backup_path))
if os.path.isdir("/Users/alichtman/Library/Application Support/Sublime\ Text\ 3"):
dotfolders_mp_in.append((os.path.join(home_path, "Library/Application\ Support/Sublime\ Text\ 3/Packages/User"), backup_path))
We should back up settings files in the If you have suggestions on how to organize this better, I'm open to talking about them.
I made exactly the same mistake the first time I contributed to an open source project. One of the best ways to learn is to make the mistake yourself :) Let's also update the README to accurately reflect the functionality of the project.
Dope work so far, man. I understand the time restrictions, whenever you have it ready for another review, just let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's more of a thorough code review. Looks great so far, just some minor changes to make.
because of my interest in issue #67 I want to ask if you are already working on extracting the hardcoded paths? |
Hey, About the Would it be alright for you to keep both copy methods, since the @raypatterson77 I have not yet started the extraction, so you could start doing it, but if this PR is merged soon, it may be worth to do the issue #67 after that. Otherwise we might create some conflicts. |
I added this as a comment on the PR, but it's here for continuity in the conversation: Both methods copy one directory to another path. We should be able to merge them together into one function that can serve all purposes (without complicating the logic too much further.) I think all that would be needed is one extra |
@raypatterson77 This PR is going to be merged soon (we're really close to finishing all this up.) So maybe the best move is to chill until this is merged and then start refactoring from there? |
dfa18a5
to
eeea9bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two comments are the last two things that jump out at me. I think all issues have been resolved, apart from these two one-line refactors.
I'm ready to merge this in after these are fixed (unless there's something I'm missing.)
Awesome work, @schilli91!
I reverted it after deciding I liked it more with tabs than spaces. idk, spacing standards are one of the less important standards, imo. Also, make sure you put your info in |
I had a really hard time merging after recent PRs. I hope everything is now resolved and we can merge. 😛 |
Great work, again, @schilli91! Thanks for contributing! |
Backup software configurations and terminal plist file and add -reinstall_configs mode to reinstall backups.