diff --git a/doc/manual.md b/doc/manual.md index c63699190..cd7278c45 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -1017,7 +1017,6 @@ A query term can be any of the following: - `depth:N` - match (or display, depending on command) accounts at or above this [depth](#depth-limiting) - `status:*` or `status:!` or `status:` - match cleared, pending, or uncleared/pending transactions respectively - `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 that is equal to, less than, or greater than N. (Multi-commodity amounts are not tested, and will always match.) diff --git a/hledger-lib/Hledger/Query.hs b/hledger-lib/Hledger/Query.hs index da382a21a..f545ee759 100644 --- a/hledger-lib/Hledger/Query.hs +++ b/hledger-lib/Hledger/Query.hs @@ -28,7 +28,6 @@ module Hledger.Query ( queryDateSpan, queryDateSpan', queryDepth, - queryEmpty, inAccount, inAccountQuery, -- * matching @@ -541,23 +540,6 @@ queryDepth q = case queryDepth' q of [] -> 99999 queryDepth' (And qs) = concatMap queryDepth' qs queryDepth' _ = [] --- | The empty (zero amount) status specified by this query, defaulting to false. -queryEmpty :: Query -> Bool -queryEmpty = headDef False . queryEmpty' - where - queryEmpty' (Empty v) = [v] - queryEmpty' (Or qs) = concatMap queryEmpty' qs - queryEmpty' (And qs) = concatMap queryEmpty' qs - queryEmpty' _ = [] - --- -- | The "include empty" option specified by this query, defaulting to false. --- emptyQueryOpt :: [QueryOpt] -> Bool --- emptyQueryOpt = headDef False . emptyQueryOpt' --- where --- emptyQueryOpt' [] = False --- emptyQueryOpt' (QueryOptEmpty v:_) = v --- emptyQueryOpt' (_:vs) = emptyQueryOpt' vs - -- | The account we are currently focussed on, if any, and whether subaccounts are included. -- Just looks at the first query option. inAccount :: [QueryOpt] -> Maybe (AccountName,Bool) diff --git a/hledger-lib/Hledger/Reports/PostingsReport.hs b/hledger-lib/Hledger/Reports/PostingsReport.hs index 9428e5a09..d4c2d31a2 100644 --- a/hledger-lib/Hledger/Reports/PostingsReport.hs +++ b/hledger-lib/Hledger/Reports/PostingsReport.hs @@ -80,7 +80,7 @@ postingsReport opts q j = (totallabel, items) journalPostings $ journalSelectingAmountFromOpts opts j (precedingps, reportps) = dbg1 "precedingps, reportps" $ span (beforestartq `matchesPosting`) pstoend - showempty = queryEmpty q || average_ opts + showempty = empty_ opts || average_ opts -- displayexpr = display_ opts -- XXX interval = intervalFromOpts opts -- XXX @@ -234,7 +234,7 @@ tests_postingsReport = [ -- with query and/or command-line options assertEqual "" 11 (length $ snd $ postingsReport defreportopts Any samplejournal) assertEqual "" 9 (length $ snd $ postingsReport defreportopts{monthly_=True} Any samplejournal) - assertEqual "" 19 (length $ snd $ postingsReport defreportopts{monthly_=True} (Empty True) samplejournal) + assertEqual "" 19 (length $ snd $ postingsReport defreportopts{monthly_=True, empty_=True} Any samplejournal) assertEqual "" 4 (length $ snd $ postingsReport defreportopts (Acct "assets:bank:checking") samplejournal) -- (defreportopts, And [Acct "a a", Acct "'b"], samplejournal2) `gives` 0