[add :echo and :addhist commands, read config file on startup of jhci
John Meacham <john@repetae.net>**20051210044736] hunk ./Interactive.hs 106
+        runInteraction initialInteract ":execfile jhci.rc"
hunk ./Interactive.hs 108
-    initialInteract = emptyInteract { interactSettables = ["prog", "args"], interactVersion = versionString, interactCommands = commands, interactExpr = do_expr }
+    initialInteract = emptyInteract {
+        interactSettables = ["prog", "args"],
+        interactVersion = versionString,
+        interactCommands = commands,
+        interactExpr = do_expr
+        }
hunk ./Util/Interact.hs 43
+--    (":execfile!", "run sequence of commands from a file if it exists"),
+    (":echo", "echo argument to screen"),
+    (":addhist", "add argument to command line history"),
hunk ./Util/Interact.hs 74
-    interactExpr :: Interact -> String -> IO Interact -- ^ what to run on a bare expression
+    interactExpr :: Interact -> String -> IO Interact, -- ^ what to run on a bare expression
+    interactRC   :: [String],               -- ^ commands to run at startup
+    interactEcho :: Bool                    -- ^ whether to echo commands
hunk ./Util/Interact.hs 85
-    interactExpr = \i s -> putStrLn ("Unknown Command: " ++ s) >> return i
+    interactExpr = \i s -> putStrLn ("Unknown Command: " ++ s) >> return i,
+    interactRC = [],
+    interactEcho = False
hunk ./Util/Interact.hs 102
+    act <- runInteractions act { interactRC = [] } (interactRC act)
hunk ./Util/Interact.hs 119
+            when (interactEcho act) $ putStrLn $ (interactPrompt act) ++ s
hunk ./Util/Interact.hs 126
+            [":echo"] -> putStrLn arg >> return act
+            [":addhist"] -> addHistory arg >> return act
hunk ./Util/Interact.hs 138
-                fc <- catch (readFile arg) (\_ -> putStrLn "Could not read file." >> return "")
-                runInteractions act (lines fc)
+                fc <- catch (readFile arg) (\_ -> putStrLn ("Could not read file: " ++ arg) >> return "")
+                act <- runInteractions act { interactEcho = True } (lines fc)
+                return act { interactEcho = False }
+            [":execfile!"] -> do
+                fc <- catch (readFile arg) (\_ -> return "")
+                runInteractions act { interactEcho = True } (lines fc)