aboutsummaryrefslogtreecommitdiff
path: root/Command/RmUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-22 17:18:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-22 17:18:53 -0400
commit82a188fcee59067a389e59fd5c30eabd1ef7ac03 (patch)
tree5960bc7e6bd578e6873a8e90bed9c58d86b4554b /Command/RmUrl.hs
parent2ae8b1701203e6f977cf6d1d7f53db1c01222aee (diff)
rmurl: New command, removes one of the recorded urls for a file.
Diffstat (limited to 'Command/RmUrl.hs')
-rw-r--r--Command/RmUrl.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Command/RmUrl.hs b/Command/RmUrl.hs
new file mode 100644
index 000000000..d3ded38a3
--- /dev/null
+++ b/Command/RmUrl.hs
@@ -0,0 +1,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