summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbringert <unknown>2004-12-09 09:51:41 +0000
committerbringert <unknown>2004-12-09 09:51:41 +0000
commit0d99169a7f3500fc13a610d1ebe3ca10926ec86a (patch)
tree68d39b8d2d69ff402a9f1a7801740323800efe11 /src
parent087b30adc98932dde2edb0f3bd01c56007af4bb5 (diff)
Make flag value checking depend on the command. Fixed spurious error messages with pm -printer values.
Diffstat (limited to 'src')
-rw-r--r--src/GF/Shell/ShellCommands.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/GF/Shell/ShellCommands.hs b/src/GF/Shell/ShellCommands.hs
index 78c023f50..846c753bc 100644
--- a/src/GF/Shell/ShellCommands.hs
+++ b/src/GF/Shell/ShellCommands.hs
@@ -90,19 +90,21 @@ isValidOption st co op = case op of
testErr (elem o $ optsOf co) ("invalid option:" +++ prOpt op)
Opt (o,[x]) -> do
testErr (elem o (flagsOf co)) ("invalid flag:" +++ o)
- testValidFlag st o x
+ testValidFlag st co o x
_ -> Bad $ "impossible option" +++ prOpt op
where
optsOf co = ("tr" :) $ fst $ optionsOfCommand co
flagsOf co = snd $ optionsOfCommand co
-testValidFlag :: ShellState -> OptFunId -> String -> Err ()
-testValidFlag st f x = case f of
+testValidFlag :: ShellState -> Command -> OptFunId -> String -> Err ()
+testValidFlag st co f x = case f of
"cat" -> testIn (map prQIdent_ (allCategories st))
"lang" -> testIn (map prt (allLanguages st))
"res" -> testIn (map prt (allResources (srcModules st)))
"number" -> testN
- "printer" -> testInc customGrammarPrinter
+ "printer" -> case co of
+ CPrintGrammar -> testInc customGrammarPrinter
+ CPrintMultiGrammar -> testInc customMultiGrammarPrinter
"lexer" -> testInc customTokenizer
"unlexer" -> testInc customUntokenizer
"depth" -> testN