summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-20 11:59:27 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-20 11:59:27 -0400
commit68761ce4846acfc25ac30539736f81aa70c90085 (patch)
treefd9c69bfa4981eb7e67e4be09c10b7767674bdc5
parentd7e32e5c055b294d45676ba4958be8a9e58f3894 (diff)
fix build with new optparse-applicative release
-rw-r--r--Test.hs18
1 files changed, 16 insertions, 2 deletions
diff --git a/Test.hs b/Test.hs
index 209242fb3..8fbaf1d94 100644
--- a/Test.hs
+++ b/Test.hs
@@ -17,6 +17,9 @@ import Test.Tasty.Ingredients.Rerun
import Data.Monoid
import Options.Applicative hiding (command)
+#if MIN_VERSION_optparse_applicative(0,8,0)
+import qualified Options.Applicative.Types as Opt
+#endif
import Control.Exception.Extensible
import qualified Data.Map as M
import System.IO.HVFS (SystemFS(..))
@@ -103,8 +106,7 @@ main ps = do
-- parameters is "test".
let pinfo = info (helper <*> suiteOptionParser ingredients tests)
( fullDesc <> header "Builtin test suite" )
- opts <- either (\f -> error =<< errMessage f "git-annex test") return $
- execParserPure (prefs idm) pinfo ps
+ opts <- parseOpts (prefs idm) pinfo ps
case tryIngredients ingredients opts tests of
Nothing -> error "No tests found!?"
Just act -> ifM act
@@ -114,6 +116,18 @@ main ps = do
putStrLn " with utilities, such as git, installed on this system.)"
exitFailure
)
+ where
+ progdesc = "git-annex test"
+ parseOpts pprefs pinfo args =
+#if MIN_VERSION_optparse_applicative(0,8,0)
+ pure $ case execParserPure pprefs pinfo args of
+ Opt.Success v -> v
+ Opt.Failure f -> error $ fst $ Opt.execFailure f progdesc
+ Opt.CompletionInvoked _ -> error "completion not supported"
+#else
+ either (error <=< flip errMessage progdesc) return $
+ execParserPure pprefs pinfo args
+#endif
ingredients :: [Ingredient]
ingredients =