git @ Cat's Eye Technologies Falderal / 2db1ef1
More command line options; fix verbosity option. catseye 13 years ago
1 changed file(s) with 13 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
88 import Test.Falderal.Reporter (report)
99
1010 --
11 -- This module contains entry points to Falderal functionality intended
12 -- for use by users.
11 -- Main module for the `falderal` tool -- a command-line interface to
12 -- `Test.Falderal`.
1313 --
1414
1515 --
1717 --
1818
1919 data Flag = ReportFormat String
20 | Verbosity Integer
20 | ShowVersion
21 | HaskellCommand String
22 | ShellCommand String
23 | Verbosity String
2124 deriving (Show, Ord, Eq)
2225
2326 determineReportFormat [] = "standard"
2528 determineReportFormat (_:rest) = determineReportFormat rest
2629
2730 determineVerbosity [] = 0
28 determineVerbosity (Verbosity v:_) = v
31 determineVerbosity (Verbosity v:_) = (read v) :: Int
2932 determineVerbosity (_:rest) = determineVerbosity rest
3033
3134 --
4649
4750 options :: [OptDescr Flag]
4851 options = [
49 Option ['v'] ["verbosity"] (ReqArg ReportFormat "LEVEL") "verbosity level, higher is more verbose (default: 0)",
50 Option ['r'] ["report"] (ReqArg ReportFormat "FORMAT") "success/failure report format (default: standard)"
52 Option ['h'] ["haskell-command"] (ReqArg HaskellCommand "CMD") "command to run Haskell tests (default: 'ghc -e testModule')",
53 Option ['r'] ["report-format"] (ReqArg ReportFormat "FORMAT") "success/failure report format (default: standard)",
54 Option ['s'] ["shell-command"] (ReqArg ShellCommand "CMD") "command to run shell scripts (default: 'sh')",
55 Option ['v'] ["verbosity"] (ReqArg Verbosity "LEVEL") "verbosity level, higher is more verbose (default: 0)",
56 Option ['V'] ["version"] (NoArg ShowVersion) "show version and exit"
5157 ]
5258
5359 dispatch ("format":formatName:fileNames) _ = do
7682 --
7783 testHaskell blocks reportFormat verbosity =
7884 runTests blocks reportFormat verbosity
79 ("GeneratedFalderalTests.hs", "haskell", "ghc GeneratedFalderalTests.hs -e testModule")
85 ("GeneratedFalderalTests.hs", "haskell", "ghc -e testModule GeneratedFalderalTests.hs")
8086
8187 testShell blocks reportFormat verbosity =
8288 runTests blocks reportFormat verbosity