add whenM and unlessM
Just more golfing.. I am pretty sure something in a library somewhere can do this, but I have been unable to find it.
This commit is contained in:
parent
75a3f5027f
commit
c91929f693
16 changed files with 60 additions and 63 deletions
|
@ -7,11 +7,11 @@
|
|||
|
||||
module Command.Find where
|
||||
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.State (liftIO)
|
||||
|
||||
import Command
|
||||
import Content
|
||||
import Utility
|
||||
|
||||
command :: [Command]
|
||||
command = [repoCommand "find" (paramOptional $ paramRepeating paramPath) seek
|
||||
|
@ -23,6 +23,5 @@ seek = [withFilesInGit start]
|
|||
{- Output a list of files. -}
|
||||
start :: CommandStartString
|
||||
start file = isAnnexed file $ \(key, _) -> do
|
||||
exists <- inAnnex key
|
||||
when exists $ liftIO $ putStrLn file
|
||||
whenM (inAnnex key) $ liftIO $ putStrLn file
|
||||
stop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue