ui: show nonzero (empty) mode, turn it off by default
-E/--empty is now the default for hledger-ui, so accounts with 0 balance and transactions posting 0 change are shown by default. The E key toggles this, entering "nonzero" mode which hides zero items.
This commit is contained in:
parent
6acd57da53
commit
16bb17fbe8
@ -106,6 +106,7 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
[ui]
|
||||
where
|
||||
toplabel = files
|
||||
<+> nonzero
|
||||
<+> str " accounts"
|
||||
<+> borderQueryStr querystr
|
||||
<+> togglefilters
|
||||
@ -129,6 +130,8 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
] of
|
||||
[] -> str ""
|
||||
fs -> str " with " <+> withAttr (borderAttr <> "query") (str $ intercalate ", " fs) <+> str " txns"
|
||||
nonzero | empty_ ropts = str ""
|
||||
| otherwise = withAttr (borderAttr <> "query") (str " nonzero")
|
||||
cur = str (case l^.listSelectedL of
|
||||
Nothing -> "-"
|
||||
Just i -> show (i + 1))
|
||||
@ -138,7 +141,7 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
-- ("up/down/pgup/pgdown/home/end", "move")
|
||||
("-=1234567890", "depth")
|
||||
,("F", "flat?")
|
||||
,("E", "empty?")
|
||||
,("E", "nonzero?")
|
||||
,("C", "cleared?")
|
||||
,("R", "real?")
|
||||
,("right/enter", "register")
|
||||
|
||||
@ -79,7 +79,9 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
||||
depth_=depthfromoptsandargs,
|
||||
-- remove depth: args from query_
|
||||
query_=unwords $ -- as in ReportOptions, with same limitations
|
||||
[v | (k,v) <- rawopts_ copts, k=="args", not $ "depth" `isPrefixOf` v]
|
||||
[v | (k,v) <- rawopts_ copts, k=="args", not $ "depth" `isPrefixOf` v],
|
||||
-- show items with zero amount by default, unlike the CLI
|
||||
empty_=True
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +104,7 @@ drawRegisterScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
case concat [
|
||||
if cleared_ ropts then ["cleared"] else []
|
||||
,if real_ ropts then ["real"] else []
|
||||
,if empty_ ropts then [] else ["nonzero"]
|
||||
] of
|
||||
[] -> str ""
|
||||
fs -> withAttr (borderAttr <> "query") (str $ " " ++ intercalate ", " fs)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user