summaryrefslogtreecommitdiff
path: root/src/GF/Shell.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-03-02 20:27:42 +0000
committeraarne <aarne@cs.chalmers.se>2006-03-02 20:27:42 +0000
commit6c5763615fc3e2c5fb40b15daec39d301a0a9a18 (patch)
tree39043e0f658b02e018088a3636fe3b83f6c7b11a /src/GF/Shell.hs
parent32508e37b37a0baad884e6aaa518071b62e1e6d8 (diff)
several treebanks in shell state
Diffstat (limited to 'src/GF/Shell.hs')
-rw-r--r--src/GF/Shell.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 39460b2f2..d502b74ce 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -308,13 +308,18 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
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
+ let tbs = treebanks st
+ if null tbs
+ then returnArg (AError "no treebank") sa
+ else do
+ let tbi = maybe (fst $ head tbs) I.identC (getOptVal opts (aOpt "treebank"))
+ case lookup tbi tbs of
+ Nothing -> returnArg (AError ("no treebank" +++ prt tbi)) sa
+ Just 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