diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-10 00:55:53 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-10 01:39:06 -0400 |
commit | 56c0bf6c690ffddc4ac561393f4cd21d087b7ddb (patch) | |
tree | 745ab36efe39f693d776a16a73758e04409f74a1 /Types | |
parent | ea0f914261e4747de75339952c2d47374c5a7803 (diff) |
convert global options (still not used)
Diffstat (limited to 'Types')
-rw-r--r-- | Types/DeferredParse.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Types/DeferredParse.hs b/Types/DeferredParse.hs index 4b5ee6d59..4c6e90175 100644 --- a/Types/DeferredParse.hs +++ b/Types/DeferredParse.hs @@ -12,7 +12,7 @@ module Types.DeferredParse where import Annex import Common -import Options.Applicative.Types +import Options.Applicative -- Some values cannot be fully parsed without performing an action. -- The action may be expensive, so it's best to call finishParse on such a @@ -40,11 +40,12 @@ instance DeferredParseClass [DeferredParse a] where -- Use when the Annex action modifies Annex state. type GlobalSetter = DeferredParse () -globalOpt :: Annex () -> Parser Bool -> Parser GlobalSetter -globalOpt setter parser = go <$> parser - where - go False = ReadyParse () - go True = DeferredParse setter +globalFlag :: Annex () -> Mod FlagFields GlobalSetter -> Parser GlobalSetter +globalFlag setter = flag' (DeferredParse setter) globalSetter :: (v -> Annex ()) -> Parser v -> Parser GlobalSetter globalSetter setter parser = DeferredParse . setter <$> parser + +globalSetters :: [Parser GlobalSetter] -> Parser GlobalSetter +globalSetters l = DeferredParse . sequence_ . map getParsed + <$> many (foldl1 (<|>) l) |