diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-06 21:27:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-06 21:32:08 -0400 |
commit | 8e7de0104702d59e327694451303e8fbe53c9ea5 (patch) | |
tree | d88304288cf83e39984df73410e1a9836217d888 /Seek.hs | |
parent | 539f8c6f144e7fa9cb76f34c06417e3c13ff3420 (diff) |
log --before=date
Diffstat (limited to 'Seek.hs')
-rw-r--r-- | Seek.hs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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] |