Skip to content

Commit

Permalink
conf -b and bench for benchmark.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Dec 11, 2012
1 parent f0c8f0c commit afd8956
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions CmdDB.hs
Expand Up @@ -64,7 +64,9 @@ commandDB = [
, routing = RouteCabal ["configure"]
, switches = [(SwSandbox, Just "--sandbox")
,(SwFlag, Just "--flags")
,(SwTest, Just "--enable-tests")]
,(SwTest, Just "--enable-tests")
,(SwBench, Just "--enable-benchmarks")
]
, manual = Nothing
}
, CommandSpec {
Expand Down Expand Up @@ -196,6 +198,14 @@ commandDB = [
, switches = [(SwSandbox, Just "--sandbox")]
, manual = Nothing
}
, CommandSpec {
command = Bench
, commandNames = ["bench"]
, document = "Run benchmarks"
, routing = RouteCabal ["bench"]
, switches = [(SwSandbox, Just "--sandbox")]
, manual = Nothing
}
, CommandSpec {
command = Doc
, commandNames = ["doc", "haddock", "man"]
Expand Down Expand Up @@ -255,13 +265,16 @@ getOptDB = [
, Option ['t'] ["test"]
(NoArg OptTest)
"Enable test"
, Option ['b'] ["bench"]
(NoArg OptBench)
"Enable benchmark"
, Option ['h'] ["help"]
(NoArg OptHelp)
"Show help message"
]

optionDB :: OptionDB
optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwSandbox,SwFlag,SwTest] getOptDB
optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwSandbox,SwFlag,SwTest,SwBench] getOptDB

----------------------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions Types.hs
Expand Up @@ -16,6 +16,7 @@ data Switch = SwNoharm
| SwSandbox
| SwFlag
| SwTest
| SwBench
deriving (Eq,Show)

data Option = OptNoharm
Expand All @@ -26,6 +27,7 @@ data Option = OptNoharm
| OptFlag String
| OptTest
| OptHelp
| OptBench
deriving (Eq,Show)

toSwitch :: Option -> Switch
Expand All @@ -36,6 +38,7 @@ toSwitch OptInfo = SwInfo
toSwitch (OptSandbox _) = SwSandbox
toSwitch (OptFlag _) = SwFlag
toSwitch OptTest = SwTest
toSwitch OptBench = SwBench
toSwitch _ = error "toSwitch"

getSandbox :: [Option] -> Maybe FilePath
Expand Down Expand Up @@ -82,6 +85,7 @@ data Command = Sync
| Add
| Ghci
| Test
| Bench
| Doc
| Help
deriving (Eq,Show)
Expand Down

0 comments on commit afd8956

Please sign in to comment.