diff --git a/bin/README.md b/bin/README.md index b46dd203c..c750fa71f 100644 --- a/bin/README.md +++ b/bin/README.md @@ -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 diff --git a/bin/hledger-register-max.hs b/bin/hledger-register-max.hs index ee1af2244..ac66b5f08 100755 --- a/bin/hledger-register-max.hs +++ b/bin/hledger-register-max.hs @@ -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]