Skip to content

Commit

Permalink
docs: Add more feature truth tables
Browse files Browse the repository at this point in the history
These are much easier to understand at a glance than free-form text.
  • Loading branch information
medhefgo authored and xclaesse committed Aug 11, 2023
1 parent 32e7ebc commit 03a2a3a
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions docs/yaml/objects/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ methods:
description: |
Returns the feature, with `'auto'` converted to `'disabled'` if value is true.
| Feature / Condition | `value = true` | `value = false` |
| ------------------- | -------------- | --------------- |
| Enabled | Enabled | Enabled |
| Disabled | Disabled | Disabled |
| Auto | Disabled | Auto |
| Feature | `value = true` | `value = false` |
| -------- | -------------- | --------------- |
| Auto | Disabled | Auto |
| Enabled | Enabled | Enabled |
| Disabled | Disabled | Disabled |
posargs:
value:
Expand All @@ -44,11 +44,11 @@ methods:
description: |
Returns the feature, with `'auto'` converted to `'enabled'` if value is true.
| Feature / Condition | `value = true` | `value = false` |
| ------------------- | -------------- | --------------- |
| Enabled | Enabled | Enabled |
| Disabled | Disabled | Disabled |
| Auto | Enabled | Auto |
| Feature | `value = true` | `value = false` |
| -------- | -------------- | --------------- |
| Auto | Enabled | Auto |
| Enabled | Enabled | Enabled |
| Disabled | Disabled | Disabled |
posargs:
value:
Expand All @@ -63,6 +63,12 @@ methods:
`'enabled'` and the value is false; a disabled feature if the object
is `'auto'` or `'disabled'` and the value is false.
| Feature | `value = true` | `value = false` |
| -------- | -------------- | --------------- |
| Auto | Auto | Disabled |
| Enabled | Enabled | Error |
| Disabled | Disabled | Disabled |
example: |
`require` is useful to restrict the applicability of `'auto'` features,
for example based on other features or on properties of the host machine:
Expand Down Expand Up @@ -94,6 +100,12 @@ methods:
`'disabled'` and the value is true; an enabled feature if the object
is `'auto'` or `'enabled'` and the value is true.
| Feature | `value = true` | `value = false` |
| -------- | -------------- | --------------- |
| Auto | Enabled | Auto |
| Enabled | Enabled | Enabled |
| Disabled | Error | Disabled |
example: |
`enable_if` is useful to restrict the applicability of `'auto'` features,
particularly when passing them to [[dependency]]:
Expand Down Expand Up @@ -122,6 +134,12 @@ methods:
`'enabled'` and the value is true; a disabled feature if the object
is `'auto'` or `'disabled'` and the value is true.
| Feature | `value = true` | `value = false` |
| -------- | -------------- | --------------- |
| Auto | Disabled | Auto |
| Enabled | Error | Enabled |
| Disabled | Disabled | Disabled |
This is equivalent to `feature_opt.require(not condition)`, but may make
code easier to reason about, especially when mixed with `enable_if`
Expand Down

0 comments on commit 03a2a3a

Please sign in to comment.