From 8e7de0104702d59e327694451303e8fbe53c9ea5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 6 Jan 2012 21:27:42 -0400 Subject: log --before=date --- Seek.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Seek.hs') diff --git a/Seek.hs b/Seek.hs index fdb117de0..59a85be88 100644 --- a/Seek.hs +++ b/Seek.hs @@ -88,14 +88,18 @@ withKeys a params = return $ map (a . parse) params where parse p = fromMaybe (error "bad key") $ readKey p +withValue :: Annex v -> (v -> CommandSeek) -> CommandSeek +withValue v a params = do + r <- v + a r params + {- Modifies a seek action using the value of a field option, which is fed into - a conversion function, and then is passed into the seek action. - This ensures that the conversion function only runs once. -} withField :: Option -> (Maybe String -> Annex a) -> (a -> CommandSeek) -> CommandSeek -withField option converter a ps = do - f <- converter =<< Annex.getField (Option.name option) - a f ps +withField option converter = withValue $ + converter =<< Annex.getField (Option.name option) withNothing :: CommandStart -> CommandSeek withNothing a [] = return [a] -- cgit v1.2.3