summaryrefslogtreecommitdiff
path: root/src/GF/Shell/Commands.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Shell/Commands.hs')
-rw-r--r--src/GF/Shell/Commands.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/GF/Shell/Commands.hs b/src/GF/Shell/Commands.hs
index 9bf1f8ff2..5a16c4b59 100644
--- a/src/GF/Shell/Commands.hs
+++ b/src/GF/Shell/Commands.hs
@@ -144,13 +144,15 @@ execCommand env c s = case c of
CCEnvOpenTerm file -> do
c <- readFileIf file
let (fs,t) = envAndTerm file c
- env' <- useIOE env $ foldM (shellStateFromFiles noOptions) env fs
+ (env',_) <- execCommand env (CCEnvGFShell fs) s
+---- env' <- useIOE env $ foldM (shellStateFromFiles noOptions) env fs
return (env', execECommand env' (CNewTree t) s)
CCEnvOpenString file -> do
c <- readFileIf file
let (fs,t) = envAndTerm file c
- env' <- useIOE env $ foldM (shellStateFromFiles noOptions) env fs
+ (env',_) <- execCommand env (CCEnvGFShell fs) s
+---- env' <- useIOE env $ foldM (shellStateFromFiles noOptions) env fs
return (env', execECommand env' (CRefineParse t) s)
CCEnvOn name -> return (languageOn (language name) env,s)
@@ -177,9 +179,10 @@ execCommand env c s = case c of
cgr = canCEnv env
opts = globalOptions env
- -- format for documents: import lines of form "-- file", then term
+ -- format for documents:
+ -- GF commands of form "-- command", then term or text
envAndTerm f s =
- (map ((initFilePath f ++) . filter (/=' ') . drop 2) fs, unlines ss) where
+ (unwords (intersperse ";;" fs), unlines ss) where
(fs,ss) = span isImport (lines s)
isImport l = take 2 l == "--"