Skip to content

Commit 4a4f8c4

Browse files
committed
Alt and default template comparsions are case-insensitive
Also mention that distro and distro family can be overridden.
1 parent 89a70be commit 4a4f8c4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

_docs/060_alternates.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ commas.
2323

2424
Each condition is an attribute/value pair, separated by a period. Some
2525
conditions do not require a "value", and in that case, the period and value can
26-
be omitted. Most attributes can be abbreviated as a single letter.
26+
be omitted. Most attributes can be abbreviated as a single letter. Values are
27+
compared case-insensitive.
2728

2829
| Attribute | Meaning |
2930
| - | - |
3031
| `arch`, `a` | Valid if the value matches the architecture. Architecture is calculated by running <code>uname&nbsp;&#8209;m</code>. |
3132
| `class`, `c` | Valid if the value matches the local.class configuration. Class must be manually set using <code>yadm&nbsp;config&nbsp;local.class&nbsp;&lt;class&gt;</code>. |
3233
| `default` | Valid when no other alternate is valid. |
33-
| `distro`, `d` | Valid if the value matches the distro. Distro is calculated by running <code>lsb_release&nbsp;&#8209;si</code> or inspecting <code>/etc/os-release</code> |
34-
| `distro_family`, `f` | Valid if the value matches the distro family. Distro family is calculated by inspecting the `ID_LIKE` line from <code>/etc/os-release</code> |
34+
| `distro`, `d` | Valid if the value matches the distro. Distro is calculated by running <code>lsb_release&nbsp;&#8209;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) |
3536
| `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. |
3637
| `hostname`, `h` | Valid if the value matches the short hostname. Hostname is calculated by running <code>uname&nbsp;&#8209;n</code>, and trimming off any domain. |
3738
| `os`, `o` | Valid if the value matches the OS. OS is calculated by running <code>uname&nbsp;&#8209;s</code>. <sup>*</sup> |
@@ -43,9 +44,6 @@ The OS for "Windows Subsystem for Linux" is reported as "WSL", even though uname
4344
<br/>
4445
*
4546
The OS for Linux-like runtimes for Windows (e.g. MinGW, Cygwin) is obtained by running `uname -o`.
46-
<br/>
47-
*
48-
If `lsb_release` is not available, "distro" will be the ID specified in `/etc/os-release`.
4947
</sup></sub>
5048

5149
You may use any number of conditions, in any order. An alternate will only be
@@ -117,9 +115,10 @@ yadm configuration—with the `yadm config` command. The following sets the
117115

118116
yadm config local.class Work
119117

120-
Similarly, the values of `arch`, `os`, `hostname`, and `user` can be manually
121-
overridden using the configuration options `local.arch`, `local.os`,
122-
`local.hostname`, and `local.user`.
118+
Similarly, the values of `arch`, `os`, `hostname`, `user`, `distro`, and
119+
`distro_family` can be manually overridden using the configuration options
120+
`local.arch`, `local.os`, `local.hostname`, `local.user`, `local.distro`, and
121+
`local.distro-family`.
123122

124123
Additional local classes can be defined using the `--add` switch.
125124

_docs/070_templates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ variable. Only equality can be tested. These blocks must start with
100100
block can also be specified using the directive `{% else %}`. These directives
101101
must appear on lines by themselves. They may not appear on the same line. The
102102
"if" directive only supports testing a single variable, and there is no "elif"
103-
directive as there is in Jinja.
103+
directive as there is in Jinja. Comparisions are done case-insensitive.
104104
<br><br>
105105
If multiple classes are defined, `yadm.class=="someclass"` will be true if *any*
106106
of the defined classes are "someclass".

0 commit comments

Comments
 (0)