parsing: amt queries use the = operator by default
This commit is contained in:
parent
ec9323688f
commit
73230838c5
@ -961,7 +961,7 @@ A query term can be any of the following:
|
|||||||
- `status:1` or `status:0` - match cleared/uncleared transactions
|
- `status:1` or `status:0` - match cleared/uncleared transactions
|
||||||
- `real:1` or `real:0` - match real/virtual-ness
|
- `real:1` or `real:0` - match real/virtual-ness
|
||||||
- `empty:1` or `empty:0` - match if amount is/is not zero
|
- `empty:1` or `empty:0` - match if amount is/is not zero
|
||||||
- `amt:<N`, `amt:=N`, `amt:>N` - match postings with a single-commodity amount less than, greater than or equal to N. (Multi-commodity amounts are always matched.)
|
- `amt:N` or `amt:=N`, `amt:<N`, `amt:>N` - match postings with a single-commodity amount equal to, less than, or greater than N. (Multi-commodity amounts are always matched.)
|
||||||
- `not:` before any of the above negates the match
|
- `not:` before any of the above negates the match
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
1
NEWS.md
1
NEWS.md
@ -6,6 +6,7 @@ title: hledger news
|
|||||||
|
|
||||||
## unreleased
|
## unreleased
|
||||||
|
|
||||||
|
- parsing: amt queries use the = operator by default, eg amt:50 finds amounts equal to 50
|
||||||
- don't break when there are non-ascii characters in CSV files
|
- don't break when there are non-ascii characters in CSV files
|
||||||
- csv: add the `include` directive, useful for factoring out common rules used with multiple CSV files
|
- csv: add the `include` directive, useful for factoring out common rules used with multiple CSV files
|
||||||
- balancesheet: don't bother showing equity, it won't be useful for most of us
|
- balancesheet: don't bother showing equity, it won't be useful for most of us
|
||||||
|
|||||||
@ -251,14 +251,16 @@ parseAmountTest s =
|
|||||||
'<':s' -> (LT, readDef err s')
|
'<':s' -> (LT, readDef err s')
|
||||||
'=':s' -> (EQ, readDef err s')
|
'=':s' -> (EQ, readDef err s')
|
||||||
'>':s' -> (GT, readDef err s')
|
'>':s' -> (GT, readDef err s')
|
||||||
_ -> err
|
s' -> (EQ, readDef err s')
|
||||||
where err = error' $ "could not parse as operator followed by numeric quantity: "++s
|
where
|
||||||
|
err = error' $ "could not parse as '=', '<', or '>' (optional) followed by a numeric quantity: " ++ s
|
||||||
|
|
||||||
tests_parseAmountTest = [
|
tests_parseAmountTest = [
|
||||||
"parseAmountTest" ~: do
|
"parseAmountTest" ~: do
|
||||||
let s `gives` r = parseAmountTest s `is` r
|
let s `gives` r = parseAmountTest s `is` r
|
||||||
"<0" `gives` (LT,0)
|
"<0" `gives` (LT,0)
|
||||||
"=0.23" `gives` (EQ,0.23)
|
"=0.23" `gives` (EQ,0.23)
|
||||||
|
"0.23" `gives` (EQ,0.23)
|
||||||
">10000.10" `gives` (GT,10000.1)
|
">10000.10" `gives` (GT,10000.1)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user