git-annex/Command/DropKey.hs
Joey Hess cdbcd6f495 add web special remote
Generalized LocationLog to PresenceLog, and use a presence log to record
urls for the web special remote.
2011-07-01 15:30:42 -04:00

44 lines
933 B
Haskell

{- git-annex command
-
- Copyright 2010 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.DropKey where
import Command
import qualified Annex
import LocationLog
import Types
import Content
import Messages
command :: [Command]
command = [repoCommand "dropkey" (paramRepeating paramKey) seek
"drops annexed content for specified keys"]
seek :: [CommandSeek]
seek = [withKeys start]
start :: CommandStartKey
start key = do
present <- inAnnex key
force <- Annex.getState Annex.force
if not present
then stop
else if not force
then error "dropkey is can cause data loss; use --force if you're sure you want to do this"
else do
showStart "dropkey" (show key)
next $ perform key
perform :: Key -> CommandPerform
perform key = do
removeAnnex key
next $ cleanup key
cleanup :: Key -> CommandCleanup
cleanup key = do
logStatus key InfoMissing
return True