csv: Add docs and integration test for & operator

This commit is contained in:
Michael Sanders 2020-07-06 18:56:32 -07:00 committed by Simon Michael
parent 5ec0a518da
commit 868c6fdbac
2 changed files with 33 additions and 1 deletions

View File

@ -566,7 +566,15 @@ CSVFIELD is a percent sign followed by the field's name or column number, like `
A single matcher can be written on the same line as the "if";
or multiple matchers can be written on the following lines, non-indented.
Multiple matchers are OR'd (any one of them can match).
Multiple matchers are OR'd (any one of them can match), unless one includes
an `&` symbol, in which case it is combined with the previous matcher.
```rules
if
MATCHER
& MATCHER
RULE
```
After the patterns there should be one or more rules to apply, all
indented by at least one space. Three kinds of rule are allowed in

View File

@ -882,6 +882,30 @@ start of conditional block found, but no assignment rules afterward
)
>=1
# 44. handle conditions with & operator
<
10/2009/09,Flubber Co,50
10/2009/09,Blubber Co,50
RULES
fields date, description, amount
date-format %d/%Y/%m
currency $
account1 assets:myacct
if Flubber
& %amount 50
account2 acct
$ ./csvtest.sh
2009-09-10 Flubber Co
assets:myacct $50
acct $-50
2009-09-10 Blubber Co
assets:myacct $50
income:unknown $-50
>=0
## .
#<