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
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
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"
|
|
|
|
(paramPair paramRemote paramDesc) (withParams seek)
|
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
|
2017-11-28 18:40:26 +00:00
|
|
|
showStart' "ungroup" (Just name)
|
2012-10-01 19:12:04 +00:00
|
|
|
u <- Remote.nameToUUID name
|
2019-01-09 19:00:43 +00:00
|
|
|
next $ 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
|