diff --git a/doc/lib.m4 b/doc/lib.m4 index edf8e8529..ec0f05e7b 100644 --- a/doc/lib.m4 +++ b/doc/lib.m4 @@ -144,7 +144,7 @@ m4_define({{_reportingoptions_}}, {{ : include only pending postings/txns `-U --uncleared` -: include only uncleared (and pending) postings/txns +: include only unmarked postings/txns `-R --real` : include only non-virtual postings diff --git a/hledger-lib/Hledger/Query.hs b/hledger-lib/Hledger/Query.hs index 9437b68de..d5c0ab0a0 100644 --- a/hledger-lib/Hledger/Query.hs +++ b/hledger-lib/Hledger/Query.hs @@ -79,7 +79,7 @@ data Query = Any -- ^ always match | Acct Regexp -- ^ match postings whose account matches this regexp | Date DateSpan -- ^ match if primary date in this date span | Date2 DateSpan -- ^ match if secondary date in this date span - | Status ClearedStatus -- ^ match txns/postings with this cleared status (Status Uncleared matches all states except cleared) + | Status ClearedStatus -- ^ match txns/postings with this status | Real Bool -- ^ match if "realness" (involves a real non-virtual account ?) has this value | Amt OrdPlus Quantity -- ^ match if the amount's numeric quantity is less than/greater than/equal to/unsignedly equal to some value | Sym Regexp -- ^ match if the entire commodity symbol is matched by this regexp @@ -673,7 +673,6 @@ matchesPosting (Acct r) p = matchesPosting p || matchesPosting (originalPosting where matchesPosting p = regexMatchesCI r $ T.unpack $ paccount p -- XXX pack matchesPosting (Date span) p = span `spanContainsDate` postingDate p matchesPosting (Date2 span) p = span `spanContainsDate` postingDate2 p -matchesPosting (Status Uncleared) p = postingStatus p /= Cleared matchesPosting (Status s) p = postingStatus p == s matchesPosting (Real v) p = v == isReal p matchesPosting q@(Depth _) Posting{paccount=a} = q `matchesAccount` a @@ -694,7 +693,7 @@ tests_matchesPosting = [ (Status Cleared) `matchesPosting` nullposting{pstatus=Cleared} assertBool "negative match on cleared posting status" $ not $ (Not $ Status Cleared) `matchesPosting` nullposting{pstatus=Cleared} - assertBool "positive match on unclered posting status" $ + assertBool "positive match on uncleared posting status" $ (Status Uncleared) `matchesPosting` nullposting{pstatus=Uncleared} assertBool "negative match on unclered posting status" $ not $ (Not $ Status Uncleared) `matchesPosting` nullposting{pstatus=Uncleared} @@ -731,7 +730,6 @@ matchesTransaction (Desc r) t = regexMatchesCI r $ T.unpack $ tdescription t matchesTransaction q@(Acct _) t = any (q `matchesPosting`) $ tpostings t matchesTransaction (Date span) t = spanContainsDate span $ tdate t matchesTransaction (Date2 span) t = spanContainsDate span $ transactionDate2 t -matchesTransaction (Status Uncleared) t = tstatus t /= Cleared matchesTransaction (Status s) t = tstatus t == s matchesTransaction (Real v) t = v == hasRealPostings t matchesTransaction q@(Amt _ _) t = any (q `matchesPosting`) $ tpostings t diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index 6c9f9bec2..17bf16017 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -141,7 +141,7 @@ reportflags = [ ,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns" ,flagNone ["pending"] (setboolopt "pending") "include only pending postings/txns" - ,flagNone ["uncleared","U"] (setboolopt "uncleared") "include only uncleared (and pending) postings/txns" + ,flagNone ["uncleared","U"] (setboolopt "uncleared") "include only unmarked postings/txns" ,flagNone ["real","R"] (setboolopt "real") "include only non-virtual postings" ,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "N" "hide accounts/postings deeper than N" ,flagNone ["empty","E"] (setboolopt "empty") "show items with zero amount, normally hidden" diff --git a/site/faq.md b/site/faq.md index c2fea37b5..83ffdc43b 100644 --- a/site/faq.md +++ b/site/faq.md @@ -178,6 +178,9 @@ or [balance assertions](manual.html#assertions-and-ordering). With hledger you can also specify start and/or end dates with a query argument, date:START-END, which probably doesn't combine perfectly with the options. +- in hledger version 1.3 onward, -U/--uncleared does not match pending things. + (#564) + ### Future ? There is a [ledger4](https://github.com/ledger/ledger4) repo on diff --git a/tests/journal/status.journal b/tests/journal/status.journal new file mode 120000 index 000000000..588a79686 --- /dev/null +++ b/tests/journal/status.journal @@ -0,0 +1 @@ +../../examples/status.journal \ No newline at end of file diff --git a/tests/journal/status.test b/tests/journal/status.test index b6062c4b5..0109e85d1 100644 --- a/tests/journal/status.test +++ b/tests/journal/status.test @@ -53,10 +53,6 @@ hledger -fstatus.journal print --uncleared (a) 1 (b) 1 -2017/01/02 ! pending - (a) 1 - ! (b) 1 - >>>=0 # 6. only one of these flags (the last) takes effect @@ -69,8 +65,8 @@ hledger -fstatus.journal register --uncleared --pending --cleared # 7. these flags work with other commands hledger -fstatus.journal balance -N --uncleared >>> - 2 a - 2 b + 1 a + 1 b >>>=0 ## matching with status: query @@ -93,16 +89,12 @@ hledger -fstatus.journal print status:! >>>=0 -# 10. status: matches everything but * +# 10. status: matches unmarked only hledger -fstatus.journal print status: >>> 2017/01/01 uncleared (a) 1 (b) 1 -2017/01/02 ! pending - (a) 1 - ! (b) 1 - >>>=0