initremote: When a uuid= parameter is passed, use the specified UUID for the new special remote, instead of generating a UUID.
This can be useful in some situations, eg when the same data can be accessed via two different special remote backends.
This commit is contained in:
parent
5c804cf42e
commit
27e89aeffc
4 changed files with 42 additions and 1 deletions
|
@ -46,8 +46,14 @@ start (name:ws) = ifM (isJust <$> findExisting name)
|
|||
|
||||
perform :: RemoteType -> String -> R.RemoteConfig -> CommandPerform
|
||||
perform t name c = do
|
||||
(c', u) <- R.setup t R.Init Nothing Nothing c def
|
||||
(c', u) <- R.setup t R.Init cu Nothing c def
|
||||
next $ cleanup u name c'
|
||||
where
|
||||
cu = case M.lookup "uuid" c of
|
||||
Just s
|
||||
| isUUID s -> Just (toUUID s)
|
||||
| otherwise -> giveup "invalid uuid"
|
||||
Nothing -> Nothing
|
||||
|
||||
cleanup :: UUID -> String -> R.RemoteConfig -> CommandCleanup
|
||||
cleanup u name c = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue