git-annex/Command/InAnnex.hs

30 lines
661 B
Haskell
Raw Normal View History

{- git-annex command
-
- Copyright 2010 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
module Command.InAnnex where
import Command
2011-10-04 04:40:47 +00:00
import Annex.Content
cmd :: Command
cmd = noCommit $
command "inannex" SectionPlumbing
"checks if keys are present in the annex"
(paramRepeating paramKey)
(withParams seek)
seek :: CmdParams -> CommandSeek
seek = withKeys (commandAction . start)
start :: (SeekInput, Key) -> CommandStart
start (_, key) = inAnnexSafe key >>= dispatch
2012-11-12 05:05:04 +00:00
where
dispatch (Just True) = stop
dispatch (Just False) = exit 1
dispatch Nothing = exit 100
exit n = liftIO $ exitWith $ ExitFailure n