git-annex/Command/InAnnex.hs
Joey Hess a2ba701056 started converting to use optparse-applicative
This is a work in progress. It compiles and is able to do basic command
dispatch, including git autocorrection, while using optparse-applicative
for the core commandline parsing.

* Many commands are temporarily disabled before conversion.
* Options are not wired in yet.
* cmdnorepo actions don't work yet.

Also, removed the [Command] list, which was only used in one place.
2015-07-08 13:36:25 -04:00

28 lines
640 B
Haskell

{- git-annex command
-
- Copyright 2010 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.InAnnex where
import Common.Annex
import Command
import Annex.Content
cmd :: Command
cmd = noCommit $ command "inannex" (paramRepeating paramKey)
SectionPlumbing "checks if keys are present in the annex"
(commandParser seek)
seek :: CmdParams -> CommandSeek
seek = withKeys start
start :: Key -> CommandStart
start key = inAnnexSafe key >>= dispatch
where
dispatch (Just True) = stop
dispatch (Just False) = exit 1
dispatch Nothing = exit 100
exit n = liftIO $ exitWith $ ExitFailure n