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