diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-04-09 15:34:47 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-04-09 15:34:47 -0400 |
commit | 82cf4fdc07b75d49c27604aef600efe97722d94b (patch) | |
tree | a15daa02f1c8a6470b99fd74b7b4dc523620483a /Command | |
parent | a186bb2d8d6b0eb3c0aad578c8c4a7254cef78e2 (diff) |
contentlocationn: New plumbing command.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/ContentLocation.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Command/ContentLocation.hs b/Command/ContentLocation.hs new file mode 100644 index 000000000..555f909cd --- /dev/null +++ b/Command/ContentLocation.hs @@ -0,0 +1,32 @@ +{- git-annex command + - + - Copyright 2015 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Command.ContentLocation where + +import Common.Annex +import Command +import Annex.Content +import Types.Key + +cmd :: [Command] +cmd = [noCommit $ noMessages $ + command "contentlocation" (paramRepeating paramKey) seek + SectionPlumbing "looks up content for a key"] + +seek :: CommandSeek +seek = withKeys start + +start :: Key -> CommandStart +start k = do + liftIO . maybe exitFailure putStrLn + =<< inAnnex' (pure True) Nothing check k + stop + where + check f = ifM (liftIO (doesFileExist f)) + ( return (Just f) + , return Nothing + ) |