2010-11-14 16:35:05 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2010 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Find where
|
|
|
|
|
|
|
|
import Control.Monad (when)
|
|
|
|
import Control.Monad.State (liftIO)
|
|
|
|
|
|
|
|
import Command
|
2011-01-16 20:05:05 +00:00
|
|
|
import Content
|
2010-11-14 16:35:05 +00:00
|
|
|
|
2010-12-30 19:06:26 +00:00
|
|
|
command :: [Command]
|
2011-03-19 22:58:49 +00:00
|
|
|
command = [repoCommand "find" (paramOptional $ paramRepeating paramPath) seek
|
2010-12-30 19:06:26 +00:00
|
|
|
"lists available files"]
|
|
|
|
|
2010-12-30 18:19:16 +00:00
|
|
|
seek :: [CommandSeek]
|
2011-01-14 03:36:58 +00:00
|
|
|
seek = [withFilesInGit start]
|
2010-11-14 16:35:05 +00:00
|
|
|
|
|
|
|
{- Output a list of files. -}
|
2010-12-30 18:19:16 +00:00
|
|
|
start :: CommandStartString
|
2010-11-14 16:35:05 +00:00
|
|
|
start file = isAnnexed file $ \(key, _) -> do
|
|
|
|
exists <- inAnnex key
|
2011-03-12 19:30:17 +00:00
|
|
|
when exists $ liftIO $ putStrLn file
|
2010-11-14 16:35:05 +00:00
|
|
|
return Nothing
|