add: handle partial dates on the command line, instead of failing after all data entry

This commit is contained in:
Simon Michael 2013-03-05 02:08:53 +00:00
parent 5785eae38e
commit edcfd2abb1

View File

@ -103,8 +103,10 @@ getTransactionOrRestart j opts defdate moredefs = do
|| s == "." || s == "."
|| isRight (parseWithCtx nullctx dateandcodep $ lowercase s)) || isRight (parseWithCtx nullctx dateandcodep $ lowercase s))
when (datecodestr == ".") $ ioError $ mkIOError eofErrorType "" Nothing Nothing when (datecodestr == ".") $ ioError $ mkIOError eofErrorType "" Nothing Nothing
today <- getCurrentDay
let (sdate,code) = fromparse $ parseWithCtx nullctx dateandcodep datecodestr let (sdate,code) = fromparse $ parseWithCtx nullctx dateandcodep datecodestr
datestr = showDate $ fixSmartDate (parsedate defdate) sdate defday = fixSmartDate today $ fromparse $ (parse smartdate "" . lowercase) defdate
datestr = showDate $ fixSmartDate defday sdate
let (defdesc, moredefs') = headTailDef "" moredefs let (defdesc, moredefs') = headTailDef "" moredefs
desc <- runInteractionDefault $ askFor "description" (Just defdesc) Nothing desc <- runInteractionDefault $ askFor "description" (Just defdesc) Nothing