2007-01-30 12:07:12 +03:00
|
|
|
#!/usr/bin/runhaskell
|
2007-02-09 04:23:12 +03:00
|
|
|
-- hledger - ledger-compatible money management utilities (& haskell workout)
|
2007-01-28 11:26:25 +03:00
|
|
|
-- GPLv3, (c) Simon Michael & contributors,
|
2007-02-09 03:18:20 +03:00
|
|
|
-- John Wiegley's ledger is at http://newartisans.com/ledger.html .
|
2007-01-28 13:30:24 +03:00
|
|
|
|
2007-01-30 12:07:12 +03:00
|
|
|
import System (getArgs)
|
2007-01-28 00:51:59 +03:00
|
|
|
|
2007-01-30 12:07:12 +03:00
|
|
|
import Options
|
2007-02-09 04:23:12 +03:00
|
|
|
import Types
|
|
|
|
import Parse
|
|
|
|
import Tests
|
2007-02-09 03:18:20 +03:00
|
|
|
|
|
|
|
main :: IO ()
|
2007-01-30 12:07:12 +03:00
|
|
|
main = do
|
|
|
|
(opts, args) <- getArgs >>= getOptions
|
2007-02-09 18:54:18 +03:00
|
|
|
test
|
2007-01-30 12:07:12 +03:00
|
|
|
if "reg" `elem` args
|
2007-02-09 04:23:12 +03:00
|
|
|
then register
|
2007-02-09 18:54:18 +03:00
|
|
|
-- else if "test" `elem` args
|
|
|
|
-- then test
|
2007-02-09 04:23:12 +03:00
|
|
|
else return ()
|
2007-02-09 06:17:12 +03:00
|
|
|
|
|
|
|
-- commands
|
|
|
|
|
|
|
|
register :: IO ()
|
|
|
|
register = do
|
|
|
|
p <- parseLedgerFile ledgerFilePath
|
|
|
|
case p of
|
|
|
|
Left e -> do putStr "ledger parse error at "; print e
|
2007-02-09 12:58:11 +03:00
|
|
|
Right l -> printRegister l
|
2007-02-09 06:17:12 +03:00
|
|
|
|