ui: fix --ignore-assertions, perhaps more

This commit is contained in:
Simon Michael 2015-09-03 16:02:44 -07:00
parent 690181426d
commit 07041e1b65

View File

@ -45,15 +45,15 @@ main = do
| "help" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStr (showModeHelp uimode) >> exitSuccess | "help" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStr (showModeHelp uimode) >> exitSuccess
| "version" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn prognameandversion >> exitSuccess | "version" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn prognameandversion >> exitSuccess
| "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname) | "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname)
| otherwise = withJournalDo' opts runBrickUi | otherwise = withJournalDoUICommand opts runBrickUi
withJournalDo' :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO () -- XXX withJournalDo specialised for UIOpts
withJournalDo' opts cmd = do withJournalDoUICommand :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO ()
-- journalFilePathFromOpts (cliopts_ opts) >>= readJournalFile Nothing >>= withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do
-- either error' (cmd opts . journalApplyAliases (aliasesFromOpts $ cliopts_ opts)) rulespath <- rulesFilePathFromOpts copts
-- XXX head should be safe for now journalpath <- journalFilePathFromOpts copts
(head `fmap` journalFilePathFromOpts (cliopts_ opts)) >>= readJournalFile Nothing Nothing True >>= ej <- readJournalFiles Nothing rulespath (not $ ignore_assertions_ copts) journalpath
either error' (cmd opts . journalApplyAliases (aliasesFromOpts $ cliopts_ opts)) either error' (cmd uopts . journalApplyAliases (aliasesFromOpts copts)) ej
runBrickUi :: UIOpts -> Journal -> IO () runBrickUi :: UIOpts -> Journal -> IO ()
runBrickUi opts j = do runBrickUi opts j = do