
--backend is no longer a global option, and is only accepted by commands that actually need it. Three commands that used to support backend but don't any longer are watch, webapp, and assistant. It would be possible to make them support it, but I doubt anyone used the option with these. And in the case of webapp and assistant, the option was handled inconsistently, only taking affect when the command is run with an existing git-annex repo, not when it creates a new one. Also, renamed GlobalOption etc to AnnexOption. Because there are many options of this type that are not actually global (any more) and get added to commands that need them. Sponsored-by: Kevin Mueller on Patreon
34 lines
1 KiB
Haskell
34 lines
1 KiB
Haskell
{- git-annex command
|
|
-
|
|
- Copyright 2015-2022 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
|
-}
|
|
|
|
{-# LANGUAGE BangPatterns #-}
|
|
|
|
module Command.UnregisterUrl where
|
|
|
|
import Command
|
|
import Logs.Web
|
|
import Command.RegisterUrl (seekBatch, start, optParser, RegisterUrlOptions(..))
|
|
|
|
cmd :: Command
|
|
cmd = withAnnexOptions [jsonOptions] $ command "unregisterurl"
|
|
SectionPlumbing "unregisters an url for a key"
|
|
(paramPair paramKey paramUrl)
|
|
(seek <$$> optParser)
|
|
|
|
seek :: RegisterUrlOptions -> CommandSeek
|
|
seek o = case (batchOption o, keyUrlPairs o) of
|
|
(Batch fmt, _) -> seekBatch unregisterUrl o fmt
|
|
(NoBatch, ps) -> commandAction (start unregisterUrl ps)
|
|
|
|
unregisterUrl :: Key -> String -> Annex ()
|
|
unregisterUrl key url = do
|
|
-- Remove the url no matter what downloader;
|
|
-- registerurl can set OtherDownloader, and this should also
|
|
-- be able to remove urls added by addurl, which may use
|
|
-- YoutubeDownloader.
|
|
forM_ [minBound..maxBound] $ \dl ->
|
|
setUrlMissing key (setDownloader url dl)
|