summaryrefslogtreecommitdiff
path: root/hyprpm/src/main.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-01-28 02:04:35 +0000
committerVaxry <vaxry@vaxry.net>2024-01-28 02:04:35 +0000
commit352574d862fdd4c379816cdcc30a99c806e60c5b (patch)
treeb61f0e188179db5174ee044cc5611ae0010b65ee /hyprpm/src/main.cpp
parentbfcc2adbdab5c10eacb584dedc22764bce114a10 (diff)
hyprpm: add --force for update
closes #4547
Diffstat (limited to 'hyprpm/src/main.cpp')
-rw-r--r--hyprpm/src/main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/hyprpm/src/main.cpp b/hyprpm/src/main.cpp
index 7bc44141..cf52db0c 100644
--- a/hyprpm/src/main.cpp
+++ b/hyprpm/src/main.cpp
@@ -23,6 +23,7 @@ const std::string HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
┣ --notify | -n → Send a hyprland notification for important events (e.g. load fail)
┣ --help | -h → Show this menu
┣ --verbose | -v → Enable too much logging
+┣ --force | -f → Force an operation ignoring checks (e.g. update -f)
┗
)#";
@@ -38,7 +39,7 @@ int main(int argc, char** argv, char** envp) {
}
std::vector<std::string> command;
- bool notify = false, verbose = false;
+ bool notify = false, verbose = false, force = false;
for (int i = 1; i < argc; ++i) {
if (ARGS[i].starts_with("-")) {
@@ -49,6 +50,9 @@ int main(int argc, char** argv, char** envp) {
notify = true;
} else if (ARGS[i] == "--verbose" || ARGS[i] == "-v") {
verbose = true;
+ } else if (ARGS[i] == "--force" || ARGS[i] == "-f") {
+ force = true;
+ std::cout << Colors::RED << "!" << Colors::RESET << " Using --force, I hope you know what you are doing.\n";
} else {
std::cerr << "Unrecognized option " << ARGS[i];
return 1;
@@ -82,9 +86,9 @@ int main(int argc, char** argv, char** envp) {
return g_pPluginManager->removePluginRepo(command[1]) ? 0 : 1;
} else if (command[0] == "update") {
bool headersValid = g_pPluginManager->headersValid() == HEADERS_OK;
- bool headers = g_pPluginManager->updateHeaders();
+ bool headers = g_pPluginManager->updateHeaders(force);
if (headers) {
- bool ret1 = g_pPluginManager->updatePlugins(!headersValid);
+ bool ret1 = g_pPluginManager->updatePlugins(!headersValid || force);
if (!ret1)
return 1;