2012-10-01 19:12:04 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
2012-10-01 19:12:04 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2012-10-01 19:12:04 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Ungroup where
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import qualified Remote
|
|
|
|
import Logs.Group
|
|
|
|
import Types.Group
|
|
|
|
|
|
|
|
import qualified Data.Set as S
|
|
|
|
|
2015-07-08 16:33:27 +00:00
|
|
|
cmd :: Command
|
2015-07-08 19:08:02 +00:00
|
|
|
cmd = command "ungroup" SectionSetup "remove a repository from a group"
|
2024-06-30 16:39:18 +00:00
|
|
|
(paramPair paramRemote paramDesc)
|
|
|
|
(withParams' seek completeRemotes)
|
2012-10-01 19:12:04 +00:00
|
|
|
|
2015-07-08 19:08:02 +00:00
|
|
|
seek :: CmdParams -> CommandSeek
|
2018-10-01 18:12:06 +00:00
|
|
|
seek = withWords (commandAction . start)
|
2012-10-01 19:12:04 +00:00
|
|
|
|
|
|
|
start :: [String] -> CommandStart
|
|
|
|
start (name:g:[]) = do
|
|
|
|
u <- Remote.nameToUUID name
|
2023-04-08 19:48:32 +00:00
|
|
|
starting "ungroup" (ActionItemOther (Just (UnquotedString name)))
|
|
|
|
(SeekInput [name, g]) $
|
|
|
|
perform u (toGroup g)
|
2016-11-16 01:29:54 +00:00
|
|
|
start _ = giveup "Specify a repository and a group."
|
2012-10-01 19:12:04 +00:00
|
|
|
|
|
|
|
perform :: UUID -> Group -> CommandPerform
|
|
|
|
perform uuid g = do
|
2012-10-01 19:17:21 +00:00
|
|
|
groupChange uuid (S.delete g)
|
2012-10-01 19:12:04 +00:00
|
|
|
next $ return True
|