mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
some fix or other
This commit is contained in:
parent
8a5a69005c
commit
e16fc9aeed
20
hledger.hs
20
hledger.hs
@ -27,8 +27,8 @@ main = do
|
||||
where run cmd opts pats
|
||||
| Help `elem` opts = putStr usage
|
||||
| cmd `isPrefixOf` "test" = test opts pats
|
||||
| cmd `isPrefixOf` "print" = printcmd opts pats
|
||||
| cmd `isPrefixOf` "register" = register opts pats
|
||||
| cmd `isPrefixOf` "print" = doWithFilteredLedger opts pats printentries
|
||||
| cmd `isPrefixOf` "register" = doWithFilteredLedger opts pats printregister
|
||||
| cmd `isPrefixOf` "balance" = balance opts pats
|
||||
| otherwise = putStr usage
|
||||
|
||||
@ -49,20 +49,10 @@ test opts pats = do
|
||||
Tests.quickcheck
|
||||
return ()
|
||||
|
||||
printcmd :: Command
|
||||
printcmd opts pats = do
|
||||
doWithFilteredLedger opts pats printentries
|
||||
where
|
||||
printentries l = putStr $ showEntries $ setprecision $ entries $ rawledger l
|
||||
where
|
||||
setprecision = map (entrySetPrecision (lprecision l))
|
||||
printentries l = putStr $ showEntries $ setprecisions $ entries $ rawledger l
|
||||
where setprecisions = map (entrySetPrecision (lprecision l))
|
||||
|
||||
register :: Command
|
||||
register opts pats = do
|
||||
doWithFilteredLedger opts pats printregister
|
||||
where
|
||||
printregister l =
|
||||
putStr $ showTransactionsWithBalances
|
||||
printregister l = putStr $ showTransactionsWithBalances
|
||||
(sortBy (comparing date) $ ledgerTransactions l)
|
||||
nullamt{precision=lprecision l}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user