diff --git a/hledger/Hledger/Cli/Commands/Aregister.hs b/hledger/Hledger/Cli/Commands/Aregister.hs index 84fa66532..25c1a2b2e 100644 --- a/hledger/Hledger/Cli/Commands/Aregister.hs +++ b/hledger/Hledger/Cli/Commands/Aregister.hs @@ -161,12 +161,18 @@ accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $ itembal (_,_,_,_,_,a) = a -- show a title indicating which account was picked, which can be confusing otherwise - title = maybe mempty (\s -> foldMap TB.fromText ["Transactions in ", s, " and subaccounts:"]) macct + title = maybe mempty (\s -> foldMap TB.fromText ["Transactions in ", s, " and subaccounts", qmsg, ":"]) macct where -- XXX temporary hack ? recover the account name from the query macct = case filterQuery queryIsAcct thisacctq of Acct r -> Just . T.drop 1 . T.dropEnd 5 $ reString r -- Acct "^JS:expenses(:|$)" _ -> Nothing -- shouldn't happen + -- show a hint in the title when results are restricted by an extra query (other than depth or date or date2) + qmsg = if hasextraquery then " (matching query)" else "" + where + hasextraquery = + length (querystring_ $ _rsReportOpts $ reportspec_ copts) > 1 + && not (queryIsNull $ filterQuery (not.(\q->queryIsDepth q || queryIsDateOrDate2 q)) reportq) -- | Render one account register report line item as plain text. Layout is like so: -- @ diff --git a/hledger/test/aregister.test b/hledger/test/aregister.test index 0d0ba9d3a..91761d092 100644 --- a/hledger/test/aregister.test +++ b/hledger/test/aregister.test @@ -36,10 +36,11 @@ Transactions in a and subaccounts: 2021-01-02 a:aa 10 11 2021-01-03 a:aa:aaa 100 111 -# 4. Any additional arguments are a query, filtering the transactions. This may -# cause the running balance to diverge from the real-world running balance. +# 4. Any additional arguments are a query filtering the transactions. +# This can cause the running balance to diverge from the real-world running balance. +# For non-date/date2/depth queries, a hint is shown in the title. $ hledger -f- areg a aaa -Transactions in a and subaccounts: +Transactions in a and subaccounts (matching query): 2021-01-03 a:aa:aaa 100 100 # 5. Sorts transactions first by transaction date (earliest date of the diff --git a/hledger/test/journal/amounts-and-commodities.test b/hledger/test/journal/amounts-and-commodities.test index f16bc76a3..3ea153e87 100644 --- a/hledger/test/journal/amounts-and-commodities.test +++ b/hledger/test/journal/amounts-and-commodities.test @@ -326,7 +326,7 @@ $ hledger -f- register -V -B cur:A "amt:<5" # 24. aregister report cur: and amt: query matches currency before valuation/cost $ hledger -f- aregister a -V -B cur:A "amt:<5" -Transactions in a and subaccounts: +Transactions in a and subaccounts (matching query): 2021-01-01 a 1000 B 1000 B >=