diff options
Diffstat (limited to 'Command/Whereis.hs')
-rw-r--r-- | Command/Whereis.hs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Command/Whereis.hs b/Command/Whereis.hs new file mode 100644 index 000000000..de5192385 --- /dev/null +++ b/Command/Whereis.hs @@ -0,0 +1,41 @@ +{- git-annex command + - + - Copyright 2010 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Command.Whereis where + +import Control.Monad.State (liftIO) + +import qualified Annex +import LocationLog +import Command +import Content +import Messages +import UUID +import Types + +command :: [Command] +command = [Command "whereis" (paramOptional $ paramRepeating paramPath) seek + "lists repositories that have file content"] + +seek :: [CommandSeek] +seek = [withFilesInGit start] + +start :: CommandStartString +start file = isAnnexed file $ \(key, _) -> do + showStart "whereis" file + return $ Just $ perform key + +perform :: Key -> CommandPerform +perform key = do + g <- Annex.gitRepo + uuids <- liftIO $ keyLocations g key + pp <- prettyPrintUUIDs uuids + showLongNote $ pp + showProgress + if null $ uuids + then return Nothing + else return $ Just $ return True |