Conditional Actions - Titousensei/sisyphus GitHub Wiki
Tests are a way to do conditional actions depending on the current row.
A number of built-in tests are provided by the Pusher:
- no test (Action)
- always(): no test, the action will be applied to every row.
- direct tests (Action)
- ifNull(): if column is null or empty, then execute action
- ifNotNull(): if column is not null and not empty, then execute action
- Key-only tests: (Key, Action)
- ifFound(): if Key contains hash, then execute action
- ifMiss(): if Key does not contain hash, then execute action
- ifDup(): if Key already contains hash, execute Action; also store hash, and value. This is a combination of the frequent usage pattern to find duplicates: ifFound + always(OutputKey).
- Key+value tests: (KeyMap/KeyBinding/KeyDouble, Action)
- ifMatch(): if Key contains hash, and value is the same, then execute action
- ifDiff(): if Key contains hash, and the value is different, then execute action
- complex tests:
- onlyIf(Test, Action): evaluate test condition and execute action if true.
Many complex tests are provided in com.thefind.sisyphus.test.*
They can compare a column with a value: IfLessThan, IfLessOrEquals, IfGreaterThan, IfGreaterOrEquals, IfEquals, IfNotEquals
They can compare two or more columns: IfColumnsEqual, IfColumnsNotEqual
They can be combined: IfNot, IfAnd, IfOr
Custom tests can be implemented easily, for example IsNumber.