summaryrefslogtreecommitdiff
path: root/Command/RmUrl.hs
blob: 3f304b76ed935e78143b3d8d4770327f20d53a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{- git-annex command
 -
 - Copyright 2013 Joey Hess <joey@kitenet.net>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Command.RmUrl where

import Common.Annex
import Command
import Logs.Web

def :: [Command]
def = [notBareRepo $
	command "rmurl" (paramPair paramFile paramUrl) seek
		SectionCommon "record file is not available at url"]

seek :: CommandSeek
seek = withPairs start

start :: (FilePath, String) -> CommandStart
start (file, url) = flip whenAnnexed file $ \_ (key, _) -> do
	showStart "rmurl" file
	next $ next $ cleanup url key

cleanup :: String -> Key -> CommandCleanup
cleanup url key = do
	setUrlMissing key url
	return True