2013-08-22 22:25:21 +00:00
|
|
|
{- quvi options for git-annex
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2013 Joey Hess <id@joeyh.name>
|
2013-08-22 22:25:21 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
{-# LANGUAGE Rank2Types #-}
|
|
|
|
|
|
|
|
module Annex.Quvi where
|
|
|
|
|
|
|
|
import Common.Annex
|
|
|
|
import qualified Annex
|
|
|
|
import Utility.Quvi
|
|
|
|
import Utility.Url
|
|
|
|
|
2015-06-01 17:52:23 +00:00
|
|
|
withQuviOptions :: forall a. Query a -> [QuviParams] -> URLString -> Annex a
|
2013-08-22 22:25:21 +00:00
|
|
|
withQuviOptions a ps url = do
|
2014-02-28 18:54:02 +00:00
|
|
|
v <- quviVersion
|
2013-08-22 22:25:21 +00:00
|
|
|
opts <- map Param . annexQuviOptions <$> Annex.getGitConfig
|
2015-06-01 17:52:23 +00:00
|
|
|
liftIO $ a v (concatMap (\mkp -> mkp v) ps ++ opts) url
|
2014-02-28 18:54:02 +00:00
|
|
|
|
|
|
|
quviSupported :: URLString -> Annex Bool
|
|
|
|
quviSupported u = liftIO . flip supported u =<< quviVersion
|
|
|
|
|
|
|
|
quviVersion :: Annex QuviVersion
|
|
|
|
quviVersion = go =<< Annex.getState Annex.quviversion
|
|
|
|
where
|
|
|
|
go (Just v) = return v
|
|
|
|
go Nothing = do
|
|
|
|
v <- liftIO probeVersion
|
|
|
|
Annex.changeState $ \s -> s { Annex.quviversion = Just v }
|
|
|
|
return v
|