cli: Allow --drop in account command in tree mode.
This commit is contained in:
parent
1425301a8c
commit
5ffe1d7656
@ -83,7 +83,9 @@ accounts CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
|
||||
-- 4. print what remains as a list or tree, maybe applying --drop in the former case
|
||||
mapM_ (T.putStrLn . render) clippedaccts
|
||||
where
|
||||
render a
|
||||
| tree_ ropts = T.replicate (2 * (accountNameLevel a - 1)) " " <> accountLeafName a
|
||||
| otherwise = accountNameDrop (drop_ ropts) a
|
||||
|
||||
render a = case accountlistmode_ ropts of
|
||||
ALTree -> T.replicate indent " " <> accountLeafName droppedName
|
||||
ALFlat -> droppedName
|
||||
where
|
||||
indent = 2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)
|
||||
droppedName = accountNameDrop (drop_ ropts) a
|
||||
|
||||
@ -18,6 +18,17 @@ a
|
||||
aa
|
||||
>=
|
||||
|
||||
# drop in flat mode
|
||||
$ hledger -f - accounts --flat --drop 1
|
||||
...
|
||||
aa
|
||||
>=
|
||||
# drop in tree mode
|
||||
$ hledger -f - accounts --tree --drop 1
|
||||
...
|
||||
aa
|
||||
>=
|
||||
|
||||
# filtering transactions by tag
|
||||
$ hledger -f - accounts tag:foo
|
||||
a:aa
|
||||
|
||||
Loading…
Reference in New Issue
Block a user