get rid of hardcoded "name" lookups
Support "sameas-name" being set instead. In RenameRemote, rename which ever of the two is set.
This commit is contained in:
parent
92ff30df70
commit
d1130ea04a
15 changed files with 45 additions and 14 deletions
|
@ -9,6 +9,7 @@ module Command.RenameRemote where
|
|||
|
||||
import Command
|
||||
import qualified Annex.SpecialRemote
|
||||
import Annex.SpecialRemote.Config (nameKey, sameasNameKey)
|
||||
import qualified Logs.Remote
|
||||
import qualified Types.Remote as R
|
||||
import qualified Remote
|
||||
|
@ -46,5 +47,9 @@ start _ = giveup "Specify an old name (or uuid or description) and a new name."
|
|||
|
||||
perform :: UUID -> R.RemoteConfig -> String -> CommandPerform
|
||||
perform u cfg newname = do
|
||||
Logs.Remote.configSet u (M.insert "name" newname cfg)
|
||||
let namekey = case M.lookup sameasNameKey cfg of
|
||||
Just _ -> sameasNameKey
|
||||
Nothing -> nameKey
|
||||
Logs.Remote.configSet u (M.insert namekey newname cfg)
|
||||
|
||||
next $ return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue