summaryrefslogtreecommitdiff
path: root/src/GF/Shell.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Shell.hs')
-rw-r--r--src/GF/Shell.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 0d5332fb8..39460b2f2 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -181,6 +181,10 @@ execLine put (c@(co, os), arg, cs) (outps,st) = do
execC :: CommandOpt -> ShellIO
execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case comm of
+ CImport file | oElem (iOpt "treebank") opts -> do
+ ss <- readFileIf file >>= return . lines
+ let tb = pre2treebank $ getTreebank ss
+ changeState (addTreebank (I.identC (takeWhile (/='.') file), tb)) sa
CImport file | oElem fromExamples opts -> do
es <- liftM nub $ getGFEFiles opts file
system $ "gf -examples" +++ unlines es
@@ -303,6 +307,15 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
comm = "command" ----
returnArg (AString $ unlines $ mkTreebank opts st comm ts) sa
+ CLookupTreebank -> do
+ case treebanks st of
+ [] -> returnArg (AError "no treebank") sa
+ (_,tb):_ -> do
+ let s = prCommandArg a
+ let tes = map (string2treeErr gro . snd) $ lookupTreebank tb s
+ terms = [t | Ok t <- tes]
+ returnArg (ATrms terms) sa
+
CShowTreeGraph | oElem emitCode opts -> do -- -o
returnArg (AString $ visualizeTrees opts $ strees $ s2t a) sa
CShowTreeGraph -> do