Skip to content

Predicates

Alexis Bridoux edited this page Oct 16, 2025 · 1 revision

Predicates are used to filter the value with some commands like the path listing command.

value Variable

The variable 'value' in the predicate will be replaced when evaluating a value against the predicate. For instance, the predicate value > 10 will validate only the numeric values that are greater than 10. Strings have to be specified with single quotes to distinguish them from a variable: value == 'String'.

Mismatching Types

A predicate cannot use the 'value' variable with different types. For instance, value > 10 && value hasPrefix 'to' is not a valid predicate, as 'value' could be numeric or a string.

Comparison Operators

The standard comparison operators can be used: ==, !=, <, <=, >, >=.

  • value > 10
  • value == 'Endo'
  • value >= 'Toto' (strings are compared alphabetically)

Logic Operators

The 'and' && and 'or' || are available.

  • value == 'Riri' || value == 'Fifi' || value == 'Loulou'
  • value > 10 && value <= 20

Also, the 'not' ! operator is available and can invert an expression.

  • !value when value is a boolean. It's the same as value == false
  • !(value > 10)

Advanced Operators

Predicates can use advanced operators.

contains

Works with strings. true when the left operand contains the right operand. Case sensitive.

Ex: value contains 'ulou': true when value: "Loulou", false when value: "Riri".

isIn

Works with strings. true when the left operand matches a value given in the right operand. The right operand is a list of string separated with commas. Use backslach to escape a comma in a string.

Ex: value isIn 'Riri, Fifi, Loulou', true when value: "Riri", false when value: "Donald".

hasPrefix

Works with strings. true when the left operand starts with the right operand. Case sensitive.

Ex: value hasPrefix 'Ri': true when value: "Riri", false when value: "Fifi".

hasSuffix

Works with strings. true when the left operand ends with the right operand. Case sensitive.

Ex: value hasSuffix 'lou': true when value: "Loulou", false when value: "Fifi".

matches

Works with strings. true when the left operand matches the regular expression given as the right operand. The whole left operand has to match the regular expression to be validated.

Ex: value matches '[0-9]{3}': true when value: "123", false when value: "1010".

Boolean

When the value is a boolean, it's possible to only specify it.

Ex: value: true if value is: true, It's the same as value == true.

It's possible to use the 'not' ! operator to invert a boolean or an expression.

Ex: !value: true when value is: false. It's the same as value == false.

Clone this wiki locally