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
|
-- 4. print what remains as a list or tree, maybe applying --drop in the former case
|
||||||
mapM_ (T.putStrLn . render) clippedaccts
|
mapM_ (T.putStrLn . render) clippedaccts
|
||||||
where
|
where
|
||||||
render a
|
render a = case accountlistmode_ ropts of
|
||||||
| tree_ ropts = T.replicate (2 * (accountNameLevel a - 1)) " " <> accountLeafName a
|
ALTree -> T.replicate indent " " <> accountLeafName droppedName
|
||||||
| otherwise = accountNameDrop (drop_ ropts) a
|
ALFlat -> droppedName
|
||||||
|
where
|
||||||
|
indent = 2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)
|
||||||
|
droppedName = accountNameDrop (drop_ ropts) a
|
||||||
|
|||||||
@ -18,6 +18,17 @@ a
|
|||||||
aa
|
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
|
# filtering transactions by tag
|
||||||
$ hledger -f - accounts tag:foo
|
$ hledger -f - accounts tag:foo
|
||||||
a:aa
|
a:aa
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user