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

Full support for alternate directories (not just directories with a top-level tracked file) #490

Open
ian-h-chamberlain opened this issue Jul 11, 2024 · 2 comments
Labels

Comments

@ian-h-chamberlain
Copy link

ian-h-chamberlain commented Jul 11, 2024

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

I use ##os.Darwin alts pretty frequently to avoid polluting my home directory on non-macOS systems. In particular, I have a number of files in ~/.config/yadm/alt/Library which are macOS-specific to avoid creating a ~/Library that would otherwise not exist on Linux.

Because alternate directory names only work if there is a file at the top level, I can't just create ~/.config/yadm/alt/Library##os.Darwin, since most files are in a subdirectory of Library, for example:

~/.config/yadm/alt/Library/
└── Application Support/
    └── Code/
        └── User/
            ├── custom.css##os.Darwin
            ├── keybindings.json##os.Darwin
            ├── settings.json##os.Darwin
            ├── snippets##os.Darwin
            └── tasks.json##os.Darwin

Describe the solution you'd like

The perfect solution in this case would be for me to rename my ~/.config/yadm/alt/Library to Library##os.Darwin, and then I could rename all of its contained files to their usual names without any ## suffix.

As described in #328, directories with an alternate name will have their direct children linked, but deeply nested directories are not supported. The documentation was updated to reflect that, so I guess this is an explicit request for the alternative: to support these kinds of directories instead.

Describe alternatives you've considered

Currently, I'm simply using alts where each file has a ## suffix, but it would reduce the need to use extension.* suffixes and generally look a lot cleaner if alts could link a whole directory recursively instead.

Additional context

From what I can tell, the decision of how/whether to link an alternate is done here in alt_linking: https://github.com/TheLocehiliosan/yadm/blob/master/yadm#L695-L702

If it would be accepted, I'm willing to try updating the implementation and open a PR! I guess this might be considered a "breaking change" of sorts, since it could end up linking new files that weren't before, but I'd guess it's pretty rare to have directories like this for most users.

Edit: looks like maybe the target/condition parsing would be most important here: https://github.com/TheLocehiliosan/yadm/blob/master/yadm#L170-L171 - probably would need to split at path separators and parse out the source/conditions a little more robustly. I'm not sure how this works for top-level files today?

Copy link

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Sep 10, 2024
@ian-h-chamberlain
Copy link
Author

Still interested in this feature, but the stalebot has reminded me I was going to try implementing this myself... Seems this repo hasn't been super active recently but maybe I will give it a shot anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant