refactor: replace plugin system with native pacman manager
Remove the dynamic plugin loader (pacman/apt/pkg/universal) and drive the UI directly through PacmanManager. Rename sources and headers to kebab-case to match the project's file naming convention. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
4a773c63ce
commit
5054f04c54
23 files changed
+276
-1735
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "package-manager.h"
|
||||
|
||||
// Native Arch Linux package manager, integrated directly into the application
|
||||
class PacmanManager : public IPackageManager {
|
||||
public:
|
||||
std::string getName() const override { return "pacman"; }
|
||||
std::string getVersion() const override { return "1.0.0"; }
|
||||
std::string getDescription() const override {
|
||||
return "Gestionnaire de paquets natif d'Arch Linux";
|
||||
}
|
||||
|
||||
bool canSearch() const override { return true; }
|
||||
bool canInstall() const override { return true; }
|
||||
bool canRemove() const override { return true; }
|
||||
bool canUpdate() const override { return true; }
|
||||
bool canListInstalled() const override { return true; }
|
||||
|
||||
bool isAvailable() const override {
|
||||
return system("which pacman > /dev/null 2>&1") == 0;
|
||||
}
|
||||
|
||||
// Parse `pacman -Q` output (one "name version" line per package).
|
||||
// Exposed as static so the parsing can be unit-tested without invoking pacman.
|
||||
static std::vector<PackageInfo> parseInstalledOutput(const std::string& output);
|
||||
|
||||
std::vector<PackageInfo> search(const std::string& query) override;
|
||||
bool install(const std::string& packageName,
|
||||
std::function<void(const std::string&)> progressCallback) override;
|
||||
bool remove(const std::string& packageName,
|
||||
std::function<void(const std::string&)> progressCallback) override;
|
||||
bool update(const std::string& packageName = "",
|
||||
std::function<void(const std::string&)> progressCallback = nullptr) override;
|
||||
std::vector<PackageInfo> listInstalled() override;
|
||||
std::vector<PackageInfo> listUpdates() override;
|
||||
bool refresh(std::function<void(const std::string&)> progressCallback = nullptr) override;
|
||||
|
||||
private:
|
||||
bool isPackageInstalled(const std::string& name);
|
||||
};
|
||||
Reference in new issue
Block a user