Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

conf -b and bench for benchmark.

  • Loading branch information...
commit afd8956b81d4b84a24eb004e15841f1e4c269e36 1 parent f0c8f0c
Kazu Yamamoto authored December 11, 2012

Showing 2 changed files with 19 additions and 2 deletions. Show diff stats Hide diff stats

  1. 17  CmdDB.hs
  2. 4  Types.hs
17  CmdDB.hs
@@ -64,7 +64,9 @@ commandDB = [
64 64
        , routing = RouteCabal ["configure"]
65 65
        , switches = [(SwSandbox, Just "--sandbox")
66 66
                     ,(SwFlag, Just "--flags")
67  
-                    ,(SwTest, Just "--enable-tests")]
  67
+                    ,(SwTest, Just "--enable-tests")
  68
+                    ,(SwBench, Just "--enable-benchmarks")
  69
+                    ]
68 70
        , manual = Nothing
69 71
        }
70 72
   , CommandSpec {
@@ -197,6 +199,14 @@ commandDB = [
197 199
        , manual = Nothing
198 200
        }
199 201
   , CommandSpec {
  202
+         command = Bench
  203
+       , commandNames = ["bench"]
  204
+       , document = "Run benchmarks"
  205
+       , routing = RouteCabal ["bench"]
  206
+       , switches = [(SwSandbox, Just "--sandbox")]
  207
+       , manual = Nothing
  208
+       }
  209
+  , CommandSpec {
200 210
          command = Doc
201 211
        , commandNames = ["doc", "haddock", "man"]
202 212
        , document = "Generate manuals"
@@ -255,13 +265,16 @@ getOptDB = [
255 265
   , Option ['t'] ["test"]
256 266
       (NoArg OptTest)
257 267
       "Enable test"
  268
+  , Option ['b'] ["bench"]
  269
+      (NoArg OptBench)
  270
+      "Enable benchmark"
258 271
   , Option ['h'] ["help"]
259 272
       (NoArg OptHelp)
260 273
       "Show help message"
261 274
   ]
262 275
 
263 276
 optionDB :: OptionDB
264  
-optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwSandbox,SwFlag,SwTest] getOptDB
  277
+optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwSandbox,SwFlag,SwTest,SwBench] getOptDB
265 278
 
266 279
 ----------------------------------------------------------------
267 280
 
4  Types.hs
@@ -16,6 +16,7 @@ data Switch = SwNoharm
16 16
             | SwSandbox
17 17
             | SwFlag
18 18
             | SwTest
  19
+            | SwBench
19 20
             deriving (Eq,Show)
20 21
 
21 22
 data Option = OptNoharm
@@ -26,6 +27,7 @@ data Option = OptNoharm
26 27
             | OptFlag String
27 28
             | OptTest
28 29
             | OptHelp
  30
+            | OptBench
29 31
             deriving (Eq,Show)
30 32
 
31 33
 toSwitch :: Option -> Switch
@@ -36,6 +38,7 @@ toSwitch OptInfo        = SwInfo
36 38
 toSwitch (OptSandbox _) = SwSandbox
37 39
 toSwitch (OptFlag _)    = SwFlag
38 40
 toSwitch OptTest        = SwTest
  41
+toSwitch OptBench       = SwBench
39 42
 toSwitch _              = error "toSwitch"
40 43
 
41 44
 getSandbox :: [Option] -> Maybe FilePath
@@ -82,6 +85,7 @@ data Command = Sync
82 85
              | Add
83 86
              | Ghci
84 87
              | Test
  88
+             | Bench
85 89
              | Doc
86 90
              | Help
87 91
              deriving (Eq,Show)

0 notes on commit afd8956

Please sign in to comment.
Something went wrong with that request. Please try again.