summaryrefslogtreecommitdiff
path: root/src/GF/Shell/CommandL.hs
diff options
context:
space:
mode:
authoraarne <unknown>2004-09-23 14:41:42 +0000
committeraarne <unknown>2004-09-23 14:41:42 +0000
commit2c60a2d82a0d7b90924e7dbbcacf36afb8549d17 (patch)
tree0a04734e741c294cb9f58cfdcafa2ff2b55894dd /src/GF/Shell/CommandL.hs
parentd5b4230d6dbee8c03eedf8d181dfa2badf1a954b (diff)
Ints n
Diffstat (limited to 'src/GF/Shell/CommandL.hs')
-rw-r--r--src/GF/Shell/CommandL.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/GF/Shell/CommandL.hs b/src/GF/Shell/CommandL.hs
index 2bb240018..93214781e 100644
--- a/src/GF/Shell/CommandL.hs
+++ b/src/GF/Shell/CommandL.hs
@@ -4,6 +4,7 @@ import Operations
import UseIO
import CMacros
+import Values (Tree)
import GetTree
import ShellState
@@ -13,6 +14,7 @@ import Commands
import Char
import List (intersperse)
+import Monad (foldM)
import UTF8
@@ -39,6 +41,23 @@ editLoop env state resume = do
editLoop env' state' resume
+-- execute a command script and return a tree
+
+execCommandHistory :: CEnv -> String -> IO (CEnv,Tree)
+execCommandHistory env s = do
+ let env' = startEditEnv env
+ let state = initSStateEnv env'
+ (env',state') <- foldM exec (env,state) $ lines s
+ return $ (env',treeSState state')
+
+ where
+
+ exec (env,state) l = do
+ let c = pCommand l
+ execCommand env c state
+
+
+
getCommand :: IO Command
getCommand = do
s <- getLine
@@ -101,6 +120,7 @@ pCommand = pCommandWords . words where
"off":lang: _ -> CCEnvOff lang
"pfile" :f:_ -> CCEnvRefineParse f
"tfile" :f:_ -> CCEnvRefineWithTree f
+ "save":l:f:_ -> CCEnvSave l f
-- openstring file
-- pfile file