;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
|
||||||
|
|
||||||
[`hledger-register-max.hs`](https://github.com/simonmichael/hledger/blob/master/bin/hledger-register-max.hs)
|
[`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
|
```cli
|
||||||
$ hledger-register-max -f examples/bcexample.hledger checking
|
$ hledger-register-max -f examples/bcexample.hledger checking
|
||||||
|
|||||||
@ -38,9 +38,9 @@ main = do
|
|||||||
let r = postingsReport (reportspec_ opts) j
|
let r = postingsReport (reportspec_ opts) j
|
||||||
unless (null r) $ do
|
unless (null r) $ do
|
||||||
let
|
let
|
||||||
i = maximumBy (comparing fifth5) r
|
(_, _, mdesc, p, bal) = maximumBy (comparing fifth5) r
|
||||||
(_, _, mdesc, p, _) = i
|
d = postingDate p
|
||||||
d = postingDate p
|
|
||||||
desc = fromMaybe "" mdesc
|
desc = fromMaybe "" mdesc
|
||||||
ptxt = T.strip $ T.unlines $ first3 $ postingAsLines False True 20 15 p
|
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