mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-25 07:09:48 +01:00
add list
This commit is contained in:
parent
0ac8868724
commit
148ea16732
3 changed files with 19 additions and 1 deletions
|
@ -367,7 +367,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
|||
const auto REPOS = DataState::getAllRepositories();
|
||||
|
||||
if (REPOS.size() < 1) {
|
||||
std::cout << "\n" << std::string{Colors::RED} + "✖" + Colors::RESET + " No repos to update.";
|
||||
std::cout << "\n" << std::string{Colors::RED} + "✖" + Colors::RESET + " No repos to update.\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -632,3 +632,16 @@ bool CPluginManager::loadUnloadPlugin(const std::string& path, bool load) {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPluginManager::listAllPlugins() {
|
||||
const auto REPOS = DataState::getAllRepositories();
|
||||
|
||||
for (auto& r : REPOS) {
|
||||
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
|
||||
|
||||
for (auto& p : r.plugins) {
|
||||
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name + "\n └─ enabled: " << (p.enabled ? Colors::GREEN : Colors::RED) << (p.enabled ? "true" : "false")
|
||||
<< Colors::RESET << "\n";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,6 +21,8 @@ class CPluginManager {
|
|||
bool updateHeaders();
|
||||
bool updatePlugins(bool forceUpdateAll);
|
||||
|
||||
void listAllPlugins();
|
||||
|
||||
bool enablePlugin(const std::string& name);
|
||||
bool disablePlugin(const std::string& name);
|
||||
void ensurePluginsLoadState();
|
||||
|
|
|
@ -16,6 +16,7 @@ const std::string HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
|
|||
┣ disable [name] → Disable a plugin
|
||||
┣ update → Check and update all plugins if needed
|
||||
┣ load → Load hyprpm state. Ensure all enabled plugins are loaded.
|
||||
┣ list → List all installed plugins
|
||||
┗
|
||||
)#";
|
||||
|
||||
|
@ -79,6 +80,8 @@ int main(int argc, char** argv, char** envp) {
|
|||
g_pPluginManager->ensurePluginsLoadState();
|
||||
} else if (ARGS[1] == "load") {
|
||||
g_pPluginManager->ensurePluginsLoadState();
|
||||
} else if (ARGS[1] == "list") {
|
||||
g_pPluginManager->listAllPlugins();
|
||||
} else {
|
||||
std::cout << HELP;
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue