bool Manager::isRemoteEnabled(const Remote &remote) const { const auto it = m_mods.find(remote); if(it == m_mods.end()) return remote.isEnabled(); else return it->second.enable.value_or(remote.isEnabled()); }
bool Manager::apply() { if(!m_changes) return true; Transaction *tx = m_reapack->setupTransaction(); if(!tx) return false; bool syncAll = false; if(m_autoInstall) { m_config->install.autoInstall = m_autoInstall.value(); syncAll = m_autoInstall.value(); } if(m_bleedingEdge) m_config->install.bleedingEdge = m_bleedingEdge.value(); if(m_promptObsolete) m_config->install.promptObsolete = m_promptObsolete.value(); for(const auto &pair : m_mods) { Remote remote = pair.first; const RemoteMods &mods = pair.second; if(m_uninstall.find(remote) != m_uninstall.end()) continue; if(mods.enable) { m_reapack->setRemoteEnabled(*mods.enable, remote); if(*mods.enable && !syncAll) tx->synchronize(remote); } if(mods.autoInstall) { remote.setAutoInstall(*mods.autoInstall); m_config->remotes.add(remote); const bool isEnabled = mods.enable.value_or(remote.isEnabled()); if(isEnabled && *mods.autoInstall && !syncAll) tx->synchronize(remote); } } for(const Remote &remote : m_uninstall) m_reapack->uninstall(remote); if(syncAll) m_reapack->synchronizeAll(); tx->runTasks(); m_config->write(); reset(); return true; }
bool Manager::isRemoteEnabled(const Remote &remote) const { const auto it = m_enableOverrides.find(remote); if(it == m_enableOverrides.end()) return remote.isEnabled(); else return it->second; }