You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: _docs/060_alternates.md
+24-11
Original file line number
Diff line number
Diff line change
@@ -26,18 +26,21 @@ conditions do not require a "value", and in that case, the period and value can
26
26
be omitted. Most attributes can be abbreviated as a single letter. Values are
27
27
compared case-insensitive.
28
28
29
+
Prefixing an attribute with "~" negates the condition, meaning the condition is
30
+
considered only if the attribute/value pair evaluates to false.
31
+
29
32
| Attribute | Meaning |
30
33
| - | - |
31
-
|`arch`, `a`| Valid if the value matches the architecture. Architecture is calculated by running <code>uname ‑m</code>. |
32
-
|`class`, `c`| Valid if the value matches the local.class configuration. Class must be manually set using <code>yadm config local.class <class></code>. |
34
+
|`arch`, `a`| Valid if the value matches the architecture. Architecture is calculated by running `uname -m`. |
35
+
|`class`, `c`| Valid if the value matches the local.class configuration. Class must be manually set using `yadmconfiglocal.class <class>`. |
33
36
|`default`| Valid when no other alternate is valid. |
34
-
|`distro`, `d`| Valid if the value matches the distro. Distro is calculated by running <code>lsb_release ‑si</code> or inspecting `ID` from <code>/etc/os-release</code>|
35
-
|`distro_family`, `f`| Valid if the value matches the distro family. Distro family is calculated by inspecting `ID_LIKE` from <code>/etc/os-release</code> (or `ID` if `ID_LIKE` isn't found) |
37
+
|`distro`, `d`| Valid if the value matches the distro. Distro is calculated by running `lsb_release -si` or inspecting `ID` from `/etc/os-release`.|
38
+
|`distro_family`, `f`| Valid if the value matches the distro family. Distro family is calculated by inspecting `ID_LIKE` from `/etc/os-release` (or `ID` if `ID_LIKE` isn't found).|
36
39
|`extension`, `e`| A special "condition" that doesn't affect the selection process. Its purpose is instead to allow the alternate file to end with a certain extension to e.g. make editors highlight the content properly. |
37
-
|`hostname`, `h`| Valid if the value matches the short hostname. Hostname is calculated by running <code>uname ‑n</code>, and trimming off any domain. |
38
-
|`os`, `o`| Valid if the value matches the OS. OS is calculated by running <code>uname ‑s</code>. <sup>*</sup> |
40
+
|`hostname`, `h`| Valid if the value matches the short hostname. Hostname is calculated by running `uname -n`, and trimming off any domain. |
41
+
|`os`, `o`| Valid if the value matches the OS. OS is calculated by running `uname -s`. <sup>*</sup> |
39
42
|`template`, `t`| Valid when the value matches a supported template processor. See the [Templates](/docs/templates) section for more details. |
40
-
|`user`, `u`| Valid if the value matches the current user. Current user is calculated by running <code>id ‑u ‑n</code>. |
43
+
|`user`, `u`| Valid if the value matches the current user. Current user is calculated by running `id -u -n`. |
41
44
42
45
<sub><sup>*
43
46
The OS for "Windows Subsystem for Linux" is reported as "WSL", even though uname identifies as "Linux".
@@ -54,8 +57,9 @@ symbolic links will be created for the most appropriate version.
54
57
The "most appropriate" version is determined by calculating a score for each
55
58
version of a file. A [template](/docs/templates) is always scored higher than
56
59
any symlink condition. The number of conditions is the next largest factor in
57
-
scoring. Files with more conditions will always be favored. Any invalid
58
-
condition will disqualify that file completely.
60
+
scoring. Files with more conditions will always be favored. Negative conditions
61
+
(prefixed with "~") are scored only relative to the number of non-negated
62
+
conditions. Any invalid condition will disqualify that file completely.
59
63
60
64
If you don't care to have all versions of alternates stored in the same
61
65
directory as the generated symlink, you can place them in the
@@ -67,6 +71,7 @@ files are managed by yadm's repository:
67
71
68
72
$HOME/path/example.txt##default
69
73
$HOME/path/example.txt##class.Work
74
+
$HOME/path/example.txt##class.Work,~os.Darwin
70
75
$HOME/path/example.txt##os.Darwin
71
76
$HOME/path/example.txt##os.Darwin,hostname.host1
72
77
$HOME/path/example.txt##os.Darwin,hostname.host2
@@ -91,20 +96,28 @@ If running on a Solaris server, the link will use the default version:
0 commit comments