;bin: register-max: cleanup
This commit is contained in:
parent
dc8e0f66de
commit
7f8f98707d
@ -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
|
||||
|
||||
@ -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]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user