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
|
|
|
|
|
|
|
-- commands
|
|
|
|
|
|
|
|
register :: IO ()
|
2007-01-29 03:11:36 +03:00
|
|
|
register = do
|
2007-02-09 04:23:12 +03:00
|
|
|
p <- parseLedgerFile ledgerFile
|
2007-01-29 03:11:36 +03:00
|
|
|
case p of
|
2007-02-09 04:23:12 +03:00
|
|
|
Left e -> do putStr "ledger parse error at "; print e
|
2007-01-29 03:11:36 +03:00
|
|
|
Right l -> putStr $ showLedger l
|
2007-01-28 11:26:25 +03:00
|
|
|
|
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 04:23:12 +03:00
|
|
|
--putStr "options: "; print opts
|
|
|
|
--putStr "arguments: "; print args
|
2007-01-30 12:07:12 +03:00
|
|
|
if "reg" `elem` args
|
2007-02-09 04:23:12 +03:00
|
|
|
then register
|
|
|
|
else if "test" `elem` args
|
|
|
|
then test
|
|
|
|
else return ()
|