1- # clink
1+ # clink [ conditional symlink farm ]
22
3- conditional symlink farm manager
3+ ` clink ` is a conditional symlink farm manager. You can define features as described in [ Configuration] ( #configuration ) ,
4+ with a condition on whether directories tagged with this feature should be symlinked. This condition can
5+ either be ` all ` , the wanted OS (` macos ` | ` linux ` ) or a custom command.
46
57## Usage
68
7- ` clink link ` - creates symlinks based on Configuration
9+ ` clink link ` - creates symlinks based on ` clink.yaml ` in current directory
810
911` clink unlink [-l | --leave-orphans] ` - removes symlinks
1012
@@ -14,32 +16,42 @@ Clink is configured in a `clink.yaml` file.
1416
1517``` yaml
1618features :
17- - slug : all
18- enabled : all # all, macos, linux or custom command
19- target : ~/ # location to symlink this feature to
20- - slug : mac
21- enabled : macos
22- target : ~/
23- - slug : mac-opt
24- enabled : macos
25- target : /opt/
26- - slug : linux
27- enabled : linux
28- target : ~/
29- - slug : custom
30- # custom enabled commands have to be tagged with !command
31- # the specified command needs to return exit code 0 to count as enabled
32- enabled : !command /some/custom/script
33- target : ~/
19+ - slug : all
20+ enabled : all # all, macos, linux or custom command
21+ target : ~/ # location to symlink this feature to
22+
23+ - slug : mac
24+ enabled : macos
25+ target : ~/
26+
27+ - slug : mac-opt
28+ enabled : macos
29+ target : /opt/
30+
31+ - slug : linux
32+ enabled : linux
33+ target : ~/
34+
35+ - slug : custom
36+ # custom enabled commands have to be tagged with !command
37+ # the specified command needs to return exit code 0 to count as enabled
38+ enabled : !command /some/custom/script
39+ target : ~/
40+
41+ - slug : linux_wayland
42+ target : ~/
43+ enabled : !command /bin/bash -c "if [[ $XDG_SESSION_TYPE -ne wayland ]] ; then exit 1 ; fi"
3444` ` `
3545
36- Any directories whose name matches the format ` {slug,slug,...}<any name>` get symlinked to the specified target.
46+ The content of directories matching the format ` {slug,slug,...}<name>`, where at least one enabled feature
47+ matches a specified slug, gets symlinked to the target specified in the feature.
3748
38- **If multiple features are assigned the highest one in the config file is used. **
49+ **If multiple features are assigned, priority is determined by their order in the config file. (top - higher priority, bottom - lower priority) **
3950
4051# # Caveats
4152
4253While other symlink farms like GNU stow perform "tree folding" to figure out where symlinking is most efficient,
43- clink only symlinks files, creating non-existing parent directories in the process. To avoid leaving
44- empty "orphan" folders after unlinking, clink removes empty directories up until, but not including, the
45- original target. This behaviour can be overwritten by specifying the --leave-orphans flag with unlink.
54+ clink only symlinks files, creating non-existing parent directories in the process. This is somewhat mitigated
55+ by the default unlink behaviour, where clink removes all empty parent folders of a link, up until the target itself.
56+
57+ You can disable this by adding the `-l (--leave-orphans)` flag to unlink.
0 commit comments