mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
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
|
||||
- `real:1` or `real:0` - match real/virtual-ness
|
||||
- `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
|
||||
|
||||
<!--
|
||||
|
1
NEWS.md
1
NEWS.md
@ -6,6 +6,7 @@ title: hledger news
|
||||
|
||||
## 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
|
||||
- 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
|
||||
|
@ -251,14 +251,16 @@ parseAmountTest s =
|
||||
'<':s' -> (LT, readDef err s')
|
||||
'=':s' -> (EQ, readDef err s')
|
||||
'>':s' -> (GT, readDef err s')
|
||||
_ -> err
|
||||
where err = error' $ "could not parse as operator followed by numeric quantity: "++s
|
||||
s' -> (EQ, readDef err s')
|
||||
where
|
||||
err = error' $ "could not parse as '=', '<', or '>' (optional) followed by a numeric quantity: " ++ s
|
||||
|
||||
tests_parseAmountTest = [
|
||||
"parseAmountTest" ~: do
|
||||
let s `gives` r = parseAmountTest s `is` r
|
||||
"<0" `gives` (LT,0)
|
||||
"=0.23" `gives` (EQ,0.23)
|
||||
"0.23" `gives` (EQ,0.23)
|
||||
">10000.10" `gives` (GT,10000.1)
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user