diff options
author | vaxerski <[email protected]> | 2024-09-19 11:25:58 +0100 |
---|---|---|
committer | vaxerski <[email protected]> | 2024-09-19 11:40:00 +0100 |
commit | 71963972bff15acccd9abd0dfd3e70504609b7cc (patch) | |
tree | 422191e69207a05faa544a03a8c684a2af052e50 | |
parent | 1bc05b1f9fd55f2a7371082e6914622e4584ed54 (diff) | |
download | Hyprland-71963972bff15acccd9abd0dfd3e70504609b7cc.tar.gz Hyprland-71963972bff15acccd9abd0dfd3e70504609b7cc.zip |
args: add --version to binary args
-rw-r--r-- | src/main.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 820a248c..525ad4ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,9 @@ #include "config/ConfigManager.hpp" #include "init/initHelpers.hpp" +#include <hyprutils/string/String.hpp> +using namespace Hyprutils::String; + #include <fcntl.h> #include <iostream> #include <iterator> @@ -20,6 +23,7 @@ void help() { std::cout << " --socket NAME - Sets the Wayland socket name (for Wayland socket handover)\n"; std::cout << " --wayland-fd FD - Sets the Wayland socket fd (for Wayland socket handover)\n"; std::cout << " --i-am-really-stupid - Omits root user privileges check (why would you do that?)\n"; + std::cout << " --version -v - Print this binary's version\n"; } int main(int argc, char** argv) { @@ -110,6 +114,24 @@ int main(int argc, char** argv) { help(); return 0; + } else if (it->compare("-v") == 0 || it->compare("--version") == 0) { + auto commitMsg = trim(GIT_COMMIT_MESSAGE); + std::replace(commitMsg.begin(), commitMsg.end(), '#', ' '); + std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg + + ").\nDate: " + GIT_COMMIT_DATE + "\nTag: " + GIT_TAG + ", commits: " + GIT_COMMITS + "\n\nflags: (if any)\n"; + +#ifdef LEGACY_RENDERER + result += "legacyrenderer\n"; +#endif +#ifndef ISDEBUG + result += "debug\n"; +#endif +#ifdef NO_XWAYLAND + result += "no xwayland\n"; +#endif + + std::cout << result; + return 0; } else { std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n"; help(); |