diff --git a/CmdDB.hs b/CmdDB.hs index 7f2a4ee..cb2c238 100644 --- a/CmdDB.hs +++ b/CmdDB.hs @@ -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 { @@ -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"] @@ -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 ---------------------------------------------------------------- diff --git a/Types.hs b/Types.hs index 974bc4b..57b4a1a 100644 --- a/Types.hs +++ b/Types.hs @@ -16,6 +16,7 @@ data Switch = SwNoharm | SwSandbox | SwFlag | SwTest + | SwBench deriving (Eq,Show) data Option = OptNoharm @@ -26,6 +27,7 @@ data Option = OptNoharm | OptFlag String | OptTest | OptHelp + | OptBench deriving (Eq,Show) toSwitch :: Option -> Switch @@ -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 @@ -82,6 +85,7 @@ data Command = Sync | Add | Ghci | Test + | Bench | Doc | Help deriving (Eq,Show)