-
Notifications
You must be signed in to change notification settings - Fork 9
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
Pain point: using multiple repositories (e.g. for work vs personal) #36
Comments
Here is the current behavior: if both
|
I saw your message on friday but was taking the time to think about it for a bit longer. I was thinking about whether adding support for this somehow or just doing some form of workaround.
I think using both The workaroundsWhen the dotfiles are isolatedIf you have isolated dotfiles used at work and at home and they're never deployed together I think just making a small script that swaps the dotfiles is enough. You could create a #!/usr/bin/env python3
from pathlib import Path
from typing import Optional
import shutil
import os
home_dotfile = Path("~/.config/dotfiles_home").expanduser()
work_dotfile = Path("~/.config/dotfiles_work").expanduser()
dotfiles_dir = Path("~/.config/dotfiles").expanduser()
def active_dotfile() -> Optional[Path]:
if not dotfiles_dir.exists():
return None
if home_dotfile.exists() and not work_dotfile.exists():
return work_dotfile
elif not home_dotfile.exists() and work_dotfile.exists():
return home_dotfile
else:
return None
def main():
current_dotfile = active_dotfile()
if current_dotfile is None:
shutil.move(home_dotfile, dotfiles_dir)
os.system("tuckr add \\*")
print(f"made dotfiles become: {home_dotfile}")
elif current_dotfile == home_dotfile:
os.system("tuckr rm \\*")
shutil.move(dotfiles_dir, current_dotfile)
shutil.move(work_dotfile, dotfiles_dir)
os.system("tuckr add \\*")
print(f"swapped dotfiles to: {work_dotfile}")
elif current_dotfile == work_dotfile:
os.system("tuckr rm \\*")
shutil.move(dotfiles_dir, work_dotfile)
shutil.move(home_dotfile, dotfiles_dir)
print(f"swapped dotfiles to: {home_dotfile}")
os.system("tuckr add \\*")
if __name__ == "__main__":
main() When dotfiles are supposed to be togetherIf they're supposed to be together you could try leveraging git by creating a private repo and then creating a This does mean you can no longer control each dotfile group individual for your work dotfiles though. Adding a new functionality approachHonestly this one is the one that I try to avoid since it requires making the code more complicated but the alternate approach that I came up with is probably by allowing multiple dotfile directories, but I'd have to somehow find a sensible naming scheme for this and it also requires messing with all the symlinking related commands so they're aware of the existence of multiple dotfile directories. |
Thank you for your reply! I am using my work dotfiles and my personal dotfiles together on the same computer. For now I will use tuckr for personal and GNU stow for work (or vice versa) so that I can get around this limitation. |
Mhh I think it would be more useful to have a sperate tool which takes two repos and merges them into a single dotfile folder. So the workflow could be to clone The script should then create
This tool could then take care of all the issues which may happen and does not need changes to tuckr. Which OSes do you use? |
Yeah this is not entirely a bad workaround. But you do lose git tracking for each repo doing this. So I guess one possible workaround for that could be to symlink all groups of I could make command for this that resolves conflicts with some name mangling like if there's a Some other possible solutions
$ tuckr -c ~/.config/dotfiles_work add \*
fn get_dotfiles_path() -> Result<path::PathBuf, String>; I think I can change it to fn get_dotfiles_path(profile: Option<&str>) -> Result<PathBuf, String>; and get the profiles stuff "for free". As for usage it would be something like this Defaults to $ tuckr status Using work profile $ tuckr -p work status |
I've just added profiles to tuckr using the CLI described on the last option
The profile name is whatever comes after an underscore, so
Since I've only implemented the core functionality here, I'll be improving error messages and adding and updating documentation on the README and wiki on #37 |
Hi @RaphGL,
Do you have a recommended workflow for using tuckr with multiple stow repositories on the same machine? I want to deploy dotfiles from two separate repos:
The first repo e.g. contains IDE config, my personal
.bashrc
, etc.The second repo contains work-specific stuff, e.g. aliases that I use at my job.
I wouldn't feel right committing work stuff to a personal repository, and I don't think my employer would appreciate it either, hence the need for two separate repos.
If I clone these repos, I'll get two folders
~/.dotfiles
and~/dotfiles
in my home folder. I'd like to be able to usetuckr
with both of these at the same time.The text was updated successfully, but these errors were encountered: