imp: ui: also show declared leaf accounts (when showing zeros)

Similar to (and motivating) balance --declared, the goal is to
show a useful list of accounts when all you have is some starter
files with account declarations.
This commit is contained in:
Simon Michael 2021-11-23 09:58:50 -10:00
parent 7e47d36451
commit eb4ad8cc11
2 changed files with 7 additions and 2 deletions

View File

@ -78,8 +78,11 @@ asInit d reset ui@UIState{
where
as = map asItemAccountName displayitems
-- Further restrict the query based on the current period and future/forecast mode.
rspec' = reportSpecSetFutureAndForecast d (forecast_ $ inputopts_ copts) rspec
rspec' =
-- Further restrict the query based on the current period and future/forecast mode.
(reportSpecSetFutureAndForecast d (forecast_ $ inputopts_ copts) rspec)
-- always show declared accounts even if unused
{_rsReportOpts=ropts{declared_=True}}
-- run the report
(items,_total) = balanceReport rspec' j

View File

@ -194,6 +194,8 @@ Additional screen-specific keys are described below.
This is normally the first screen displayed.
It lists accounts and their balances, like hledger's balance command.
By default, it shows all accounts and their latest ending balances (including the balances of subaccounts).
Accounts which have been declared with an [account directive](#declaring-accounts) are also listed, even if not yet used
(except for empty parent accounts).
If you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions.
Account names are shown as a flat list by default; press `t` to toggle tree mode.