diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-10-26 14:55:40 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-10-26 14:55:40 -0400 |
commit | 5de4482c1b52ead223bc380b45fcc421e25a80a4 (patch) | |
tree | 075091a3b866e28c906a3f7d44d20b2a4fcddd33 /Annex | |
parent | 6580aa68ca335e66daab9a9c2b7f91ad6f9bd2cb (diff) |
enableremote: List uuids and descriptions of remotes that can be enabled, and accept either the uuid or the description in leu if the name.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/SpecialRemote.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Annex/SpecialRemote.hs b/Annex/SpecialRemote.hs index 44bc666ce..3892eea2f 100644 --- a/Annex/SpecialRemote.hs +++ b/Annex/SpecialRemote.hs @@ -42,10 +42,14 @@ findByName n = filter (matching . snd) . M.toList | n' == n -> True | otherwise -> False -remoteNames :: Annex [RemoteName] -remoteNames = do +specialRemoteMap :: Annex (M.Map UUID RemoteName) +specialRemoteMap = do m <- Logs.Remote.readRemoteLog - return $ mapMaybe (M.lookup nameKey . snd) $ M.toList m + return $ M.fromList $ mapMaybe go (M.toList m) + where + go (u, c) = case M.lookup nameKey c of + Nothing -> Nothing + Just n -> Just (u, n) {- find the specified remote type -} findType :: RemoteConfig -> Either String RemoteType |