2015-07-10 06:18:08 +00:00
|
|
|
{- git-annex global options
|
|
|
|
-
|
|
|
|
- Copyright 2015 Joey Hess <id@joeyh.name>
|
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2015-07-10 06:18:08 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
module CmdLine.GlobalSetter where
|
|
|
|
|
|
|
|
import Types.DeferredParse
|
|
|
|
import Common
|
|
|
|
import Annex
|
|
|
|
|
|
|
|
import Options.Applicative
|
|
|
|
|
2015-07-10 17:18:46 +00:00
|
|
|
globalFlag :: Annex () -> Mod FlagFields GlobalSetter -> GlobalOption
|
2015-07-10 06:18:08 +00:00
|
|
|
globalFlag setter = flag' (DeferredParse setter)
|
|
|
|
|
2015-07-10 17:18:46 +00:00
|
|
|
globalSetter :: (v -> Annex ()) -> Parser v -> GlobalOption
|
2015-07-10 06:18:08 +00:00
|
|
|
globalSetter setter parser = DeferredParse . setter <$> parser
|
|
|
|
|
2015-07-10 17:18:46 +00:00
|
|
|
combineGlobalOptions :: [GlobalOption] -> Parser GlobalSetter
|
2017-02-27 18:48:07 +00:00
|
|
|
combineGlobalOptions l = DeferredParse . mapM_ getParsed
|
2015-07-10 06:18:08 +00:00
|
|
|
<$> many (foldl1 (<|>) l)
|