git-annex/Command/Find.hs
Joey Hess 5a50a7cf13 update unicode FilePath handling
Based on http://hackage.haskell.org/trac/ghc/ticket/3307 ,
whether FilePath contains decoded unicode varies by OS.
So, add a configure check for it.

Also, renamed showFile to filePathToString
2011-02-11 15:37:37 -04:00

29 lines
644 B
Haskell

{- 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
import Content
import Messages
command :: [Command]
command = [Command "find" (paramOptional $ paramRepeating paramPath) seek
"lists available files"]
seek :: [CommandSeek]
seek = [withFilesInGit start]
{- Output a list of files. -}
start :: CommandStartString
start file = isAnnexed file $ \(key, _) -> do
exists <- inAnnex key
when exists $ liftIO $ putStrLn $ filePathToString file
return Nothing