return non-zero exit code on parse failure
This commit is contained in:
parent
b683ca8e40
commit
ef3b5ab98d
4
Utils.hs
4
Utils.hs
@ -33,7 +33,9 @@ withLedgerDo opts args cmdname cmd = do
|
|||||||
t <- getCurrentLocalTime
|
t <- getCurrentLocalTime
|
||||||
tc <- getClockTime
|
tc <- getClockTime
|
||||||
let go = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f,filereadtime=tc})
|
let go = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f,filereadtime=tc})
|
||||||
if creating then go rawLedgerEmpty else (runErrorT . parseLedgerFile t) f >>= either (hPutStrLn stderr) go
|
if creating then go rawLedgerEmpty else (runErrorT . parseLedgerFile t) f
|
||||||
|
>>= flip either go
|
||||||
|
(\e -> hPutStrLn stderr e >> exitWith (ExitFailure 1))
|
||||||
|
|
||||||
-- | Get a Ledger from the given string and options, or raise an error.
|
-- | Get a Ledger from the given string and options, or raise an error.
|
||||||
ledgerFromStringWithOpts :: [Opt] -> [String] -> LocalTime -> String -> IO Ledger
|
ledgerFromStringWithOpts :: [Opt] -> [String] -> LocalTime -> String -> IO Ledger
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
# shouldn't exit code be 1 ?
|
|
||||||
-f - register
|
-f - register
|
||||||
<<<
|
<<<
|
||||||
2009/1/1 a
|
2009/1/1 a
|
||||||
@ -9,8 +8,8 @@
|
|||||||
unexpected end of input
|
unexpected end of input
|
||||||
could not balance this transaction, amounts do not add up to zero:
|
could not balance this transaction, amounts do not add up to zero:
|
||||||
2009/01/01 a
|
2009/01/01 a
|
||||||
b 1.1
|
b 1.1
|
||||||
c -1
|
c -1
|
||||||
|
|
||||||
|
|
||||||
>>>= 0
|
>>>= 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user