core: add --version

This commit is contained in:
Vaxry 2024-11-18 19:42:36 +00:00
parent 26780ac51f
commit 9f23e70bb4
2 changed files with 7 additions and 0 deletions

View file

@ -18,6 +18,8 @@ else()
message(STATUS "Configuring hypridle in Release with CMake") message(STATUS "Configuring hypridle in Release with CMake")
endif() endif()
add_compile_definitions(HYPRIDLE_VERSION="${VERSION}")
include_directories(. "protocols/") include_directories(. "protocols/")
include(GNUInstallDirs) include(GNUInstallDirs)

View file

@ -15,6 +15,11 @@ int main(int argc, char** argv, char** envp) {
else if (arg == "--quiet" || arg == "-q") else if (arg == "--quiet" || arg == "-q")
Debug::quiet = true; Debug::quiet = true;
else if (arg == "--version" || arg == "-V") {
Debug::log(NONE, "hypridle v{}", HYPRIDLE_VERSION);
return 0;
}
else if (arg == "--config" || arg == "-c") { else if (arg == "--config" || arg == "-c") {
if (i + 1 >= argc) { if (i + 1 >= argc) {
Debug::log(NONE, "After " + arg + " you should provide a path to a config file."); Debug::log(NONE, "After " + arg + " you should provide a path to a config file.");