;bin: register-max: cleanup

This commit is contained in:
Simon Michael 2023-01-29 07:12:08 -10:00
parent dc8e0f66de
commit 7f8f98707d
2 changed files with 5 additions and 5 deletions

View File

@ -163,7 +163,7 @@ is the same command implemented as a cabal script rather than a stack script.
### hledger-register-max
[`hledger-register-max.hs`](https://github.com/simonmichael/hledger/blob/master/bin/hledger-register-max.hs)
runs "register -H" and prints the posting with largest historical balance.
runs a register report and prints the posting with largest historical balance.
```cli
$ hledger-register-max -f examples/bcexample.hledger checking

View File

@ -38,9 +38,9 @@ main = do
let r = postingsReport (reportspec_ opts) j
unless (null r) $ do
let
i = maximumBy (comparing fifth5) r
(_, _, mdesc, p, _) = i
d = postingDate p
(_, _, mdesc, p, bal) = maximumBy (comparing fifth5) r
d = postingDate p
desc = fromMaybe "" mdesc
ptxt = T.strip $ T.unlines $ first3 $ postingAsLines False True 20 15 p
T.putStrLn $ T.unwords [showDate d, desc, "", ptxt, "", T.pack $ showMixedAmountOneLine $ fifth5 i]
baltxt = T.pack $ showMixedAmountOneLine bal
T.putStrLn $ T.unwords [showDate d, desc, "", ptxt, "", baltxt]