From: Anders Mörtberg Date: Tue, 5 Jul 2016 12:09:46 +0000 (+0200) Subject: add batch mode flag X-Git-Url: https://git.ak3n.com/?a=commitdiff_plain;h=26f8d9c480bdcf6fd972a519cbb29b58ae88cba9;p=cubicaltt.git add batch mode flag --- diff --git a/Main.hs b/Main.hs index 56536cc..f6fc761 100644 --- a/Main.hs +++ b/Main.hs @@ -28,11 +28,12 @@ import qualified Eval as E type Interpreter a = InputT IO a -- Flag handling -data Flag = Debug | Help | Version | Time +data Flag = Debug | Batch | Help | Version | Time deriving (Eq,Show) options :: [OptDescr Flag] options = [ Option "d" ["debug"] (NoArg Debug) "run in debugging mode" + , Option "b" ["batch"] (NoArg Batch) "run in batch mode" , Option "" ["help"] (NoArg Help) "print help" , Option "-t" ["time"] (NoArg Time) "measure time spent computing" , Option "" ["version"] (NoArg Version) "print version number" ] @@ -102,8 +103,11 @@ initLoop flags f hist = do case merr of Just err -> putStrLn $ "Type checking failed: " ++ shrink err Nothing -> putStrLn "File loaded." - -- Compute names for auto completion - runInputT (settings [n | (n,_) <- names]) (putHistory hist >> loop flags f names tenv) + if Batch `elem` flags + then return () + else -- Compute names for auto completion + runInputT (settings [n | (n,_) <- names]) + (putHistory hist >> loop flags f names tenv) -- The main loop loop :: [Flag] -> FilePath -> [(CTT.Ident,SymKind)] -> TC.TEnv -> Interpreter ()