hledger/hledger.hs

31 lines
663 B
Haskell
Raw Normal View History

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)
-- 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
if "reg" `elem` args
2007-02-09 04:23:12 +03:00
then register
else if "test" `elem` args
then test
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