Skip to content

Commit 73e8f67

Browse files
committed
better docs
1 parent e4513b2 commit 73e8f67

2 files changed

Lines changed: 57 additions & 25 deletions

File tree

README.md

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
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
1618
features:
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

4253
While 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.

clink.example.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
features:
2+
- slug: all
3+
target: ~/.config
4+
enabled: all
5+
6+
- slug: mac
7+
target: ~/.config
8+
enabled: macos
9+
10+
- slug: mac_home
11+
target: ~/
12+
enabled: macos
13+
14+
- slug: linux
15+
target: ~/.config
16+
enabled: linux
17+
18+
- slug: linux_wayland
19+
target: ~/
20+
enabled: !command /bin/bash -c "if [[ $XDG_SESSION_TYPE -ne wayland ]] ; then exit 1 ; fi"

0 commit comments

Comments
 (0)