forked from external/yambar
Implement '&&' and '||' operators on map
'-' is a valid character for tags.
Commit 03e1c7d
(module/network: Add link stats, 2022-04-30) introduced
two new tags for the network module: `ul-speed` and `dl-speed`. These
use the `-` character, that was previously never used in any tag.
We had two options: either change those tags to use `_` instead, or just
accept `-`s as a valid character. Going forward, I can see many people
deciding to name their tags with `-` instead of `_`, so I believe it is
better to just accept it once and for all.
Note that `-` cannot be used as the first character of a tag (e.g.
`-tag1`) since the `-` has a special meaning in `.yml` files. I don't
believe this will happen often, however, and should be easy to both
detect and correct if it does.
This commit is contained in:
parent
463b39b56d
commit
4a41d4296a
10 changed files with 330 additions and 226 deletions
|
@ -218,11 +218,15 @@ content:
|
|||
This particle maps the values of a specific tag to different
|
||||
particles based on conditions. A condition takes either the form of:
|
||||
|
||||
```
|
||||
<tag> <operation> <value>
|
||||
```
|
||||
|
||||
Or, for boolean tags:
|
||||
|
||||
```
|
||||
<tag>
|
||||
```
|
||||
|
||||
Where <tag> is the tag you would like to map, <operation> is one of:
|
||||
|
||||
|
@ -233,15 +237,46 @@ Where <tag> is the tag you would like to map, <operation> is one of:
|
|||
:- <=
|
||||
:- <
|
||||
|
||||
and <value> is the value you would like to compare it to.
|
||||
and <value> is the value you would like to compare it to. *If the
|
||||
value contains any non-alphanumerical characters, you must
|
||||
surround it with ' " ' *:
|
||||
|
||||
For boolean tags, negation is done with a preceding '~':
|
||||
```
|
||||
"hello world"
|
||||
"@#$%"
|
||||
```
|
||||
|
||||
Negation is done with a preceding '~':
|
||||
|
||||
```
|
||||
~<tag>
|
||||
~<condition>
|
||||
```
|
||||
|
||||
To match for empty strings, use ' "" ':
|
||||
|
||||
```
|
||||
<tag> == ""
|
||||
```
|
||||
|
||||
Furthermore, you may use the boolean operators:
|
||||
|
||||
[- &&
|
||||
:- ||
|
||||
|
||||
in order to create more complex conditions:
|
||||
|
||||
```
|
||||
<condition1> && <condition2>
|
||||
```
|
||||
|
||||
You may surround <condition> with parenthesis for clarity or
|
||||
specifying precedence:
|
||||
|
||||
```
|
||||
(<condition>)
|
||||
<condition1> && (<condition2> || <condition3>)
|
||||
```
|
||||
|
||||
In addition to explicit tag values, you can also specify a
|
||||
default/fallback particle.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue