Full support for alternate directories (not just directories with a top-level tracked file)
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.DarwinDescribe 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?
Source: yadm-dev/yadm