feat: rename remote name

This commit is contained in:
2019-02-28 20:13:11 +01:00
parent 450dfc9052
commit 4b9c1fc3dd
2 changed files with 53 additions and 1 deletions

View File

@ -360,7 +360,19 @@ func (fc *FluckyConfig) RenameSensor(oldName, newName string) error {
return nil
}
}
return fmt.Errorf("Could not find sensor %v and replace the name", oldName)
return fmt.Errorf("Could not find sensor %v to replace into ", oldName)
}
// RenameRemote renames a remote address identified by the name or the UUID
func (fc *FluckyConfig) RenameRemote(oldName, newName string) error {
for _, remote := range fc.Remotes {
if remote.Name == oldName ||
remote.RemoteID == oldName {
remote.Name = newName
return nil
}
}
return fmt.Errorf("Could not find remote name %v to replace into %v", oldName, newName)
}
// ToJSON returns the struct as JSON string