summaryrefslogtreecommitdiff
path: root/hyprpm
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-02-24 13:11:25 +0000
committerVaxry <vaxry@vaxry.net>2025-02-24 13:11:30 +0000
commit73ae9790f994fe3f0194a5e225106c3dddb77d84 (patch)
tree83c31aef7ac55224930fc2f5e53f803f794e2c17 /hyprpm
parent3458d7ac93a101ea534ef6d0bcbc32725e267045 (diff)
hyprpm: add --hl-url for custom forks
Diffstat (limited to 'hyprpm')
-rw-r--r--hyprpm/src/core/PluginManager.cpp10
-rw-r--r--hyprpm/src/core/PluginManager.hpp1
-rw-r--r--hyprpm/src/main.cpp19
3 files changed, 21 insertions, 9 deletions
diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp
index 80d0a402..3343cbe0 100644
--- a/hyprpm/src/core/PluginManager.cpp
+++ b/hyprpm/src/core/PluginManager.cpp
@@ -463,7 +463,9 @@ bool CPluginManager::updateHeaders(bool force) {
return false;
}
- progress.printMessageAbove(statusString("!", Colors::YELLOW, "Cloning https://github.com/hyprwm/Hyprland, this might take a moment."));
+ const auto& HL_URL = m_szCustomHlUrl.empty() ? "https://github.com/hyprwm/Hyprland" : m_szCustomHlUrl;
+
+ progress.printMessageAbove(statusString("!", Colors::YELLOW, "Cloning {}, this might take a moment.", HL_URL));
const bool bShallow = (HLVER.branch == "main") && !m_bNoShallow;
@@ -474,12 +476,12 @@ bool CPluginManager::updateHeaders(bool force) {
if (m_bVerbose && bShallow)
progress.printMessageAbove(verboseString("will shallow since: {}", SHALLOW_DATE));
- std::string ret = execAndGet(std::format("cd {} && git clone --recursive https://github.com/hyprwm/Hyprland hyprland-{}{}", getTempRoot(), USERNAME,
- (bShallow ? " --shallow-since='" + SHALLOW_DATE + "'" : "")));
+ std::string ret =
+ execAndGet(std::format("cd {} && git clone --recursive {} hyprland-{}{}", getTempRoot(), HL_URL, USERNAME, (bShallow ? " --shallow-since='" + SHALLOW_DATE + "'" : "")));
if (!std::filesystem::exists(WORKINGDIR)) {
progress.printMessageAbove(failureString("Clone failed. Retrying without shallow."));
- ret = execAndGet(std::format("cd {} && git clone --recursive https://github.com/hyprwm/hyprland hyprland-{}", getTempRoot(), USERNAME));
+ ret = execAndGet(std::format("cd {} && git clone --recursive {} hyprland-{}", getTempRoot(), HL_URL, USERNAME));
}
if (!std::filesystem::exists(WORKINGDIR + "/.git")) {
diff --git a/hyprpm/src/core/PluginManager.hpp b/hyprpm/src/core/PluginManager.hpp
index a99d8e6e..b159b921 100644
--- a/hyprpm/src/core/PluginManager.hpp
+++ b/hyprpm/src/core/PluginManager.hpp
@@ -62,6 +62,7 @@ class CPluginManager {
bool m_bVerbose = false;
bool m_bNoShallow = false;
+ std::string m_szCustomHlUrl;
// will delete recursively if exists!!
bool createSafeDirectory(const std::string& path);
diff --git a/hyprpm/src/main.cpp b/hyprpm/src/main.cpp
index 887bb436..9f2411b0 100644
--- a/hyprpm/src/main.cpp
+++ b/hyprpm/src/main.cpp
@@ -29,6 +29,7 @@ constexpr std::string_view HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
┣ --verbose | -v → Enable too much logging
┣ --force | -f → Force an operation ignoring checks (e.g. update -f)
┣ --no-shallow | -s → Disable shallow cloning of Hyprland sources
+┣ --hl-url | → Pass a custom hyprland source url
┗
)#";
@@ -45,6 +46,7 @@ int main(int argc, char** argv, char** envp) {
std::vector<std::string> command;
bool notify = false, notifyFail = false, verbose = false, force = false, noShallow = false;
+ std::string customHlUrl;
for (int i = 1; i < argc; ++i) {
if (ARGS[i].starts_with("-")) {
@@ -59,6 +61,13 @@ int main(int argc, char** argv, char** envp) {
verbose = true;
} else if (ARGS[i] == "--no-shallow" || ARGS[i] == "-s") {
noShallow = true;
+ } else if (ARGS[i] == "--hl-url") {
+ if (i + 1 >= argc) {
+ std::println(stderr, "Missing argument for --hl-url");
+ return 1;
+ }
+ customHlUrl = ARGS[i + 1];
+ i++;
} else if (ARGS[i] == "--force" || ARGS[i] == "-f") {
force = true;
std::println("{}", statusString("!", Colors::RED, "Using --force, I hope you know what you are doing."));
@@ -66,9 +75,8 @@ int main(int argc, char** argv, char** envp) {
std::println(stderr, "Unrecognized option {}", ARGS[i]);
return 1;
}
- } else {
+ } else
command.push_back(ARGS[i]);
- }
}
if (command.empty()) {
@@ -76,9 +84,10 @@ int main(int argc, char** argv, char** envp) {
return 1;
}
- g_pPluginManager = std::make_unique<CPluginManager>();
- g_pPluginManager->m_bVerbose = verbose;
- g_pPluginManager->m_bNoShallow = noShallow;
+ g_pPluginManager = std::make_unique<CPluginManager>();
+ g_pPluginManager->m_bVerbose = verbose;
+ g_pPluginManager->m_bNoShallow = noShallow;
+ g_pPluginManager->m_szCustomHlUrl = customHlUrl;
if (command[0] == "add") {
if (command.size() < 2) {