rewire/cli/install.hpp

30 lines
874 B
C++

#pragma once
#include <filesystem>
#include <list>
#include <string>
#include <functional>
class InstallManager {
static constexpr const char* INSTALL_PATH = ".rewire/wirekits"; // Relative to home directory
bool m_valid;
std::filesystem::path m_home_directory;
std::filesystem::path m_install_directory;
public:
InstallManager(const InstallManager& other) = delete;
InstallManager(InstallManager&& other) noexcept;
InstallManager& operator=(const InstallManager& other) = delete;
InstallManager& operator=(InstallManager&& other) noexcept;
InstallManager();
~InstallManager();
operator bool() const;
bool install(const char* from, const char* to,
std::function<bool(const std::filesystem::path&)> check = {});
bool uninstall(const char* name);
bool get(const char* name, std::filesystem::path& path) const;
std::list<std::string> installs() const;
};