core: add --version and improve --help

This commit is contained in:
Vaxry 2024-09-21 16:45:23 +01:00
parent a8ebdcb011
commit 15932f0f9e
2 changed files with 11 additions and 5 deletions

View file

@ -21,6 +21,8 @@ else()
message(STATUS "Configuring XDPH in Release with CMake")
endif()
add_compile_definitions(XDPH_VERSION="${VER}")
include_directories(. "protocols/")
# configure

View file

@ -4,11 +4,12 @@
#include "core/PortalManager.hpp"
void printHelp() {
std::cout << R"#(| xdg-desktop-portal-hyprland
| --------------------------------------
| -v (--verbose) > enable trace logging
| -q (--quiet) > disable logging
| -h (--help) > print this menu
std::cout << R"#(┃ xdg-desktop-portal-hyprland
-v (--verbose) enable trace logging
-q (--quiet) disable logging
-h (--help) print this menu
-V (--version) print xdph's version
)#";
}
@ -27,6 +28,9 @@ int main(int argc, char** argv, char** envp) {
else if (arg == "--help" || arg == "-h") {
printHelp();
return 0;
} else if (arg == "--version" || arg == "-V") {
std::cout << "xdg-desktop-portal-hyprland v" << XDPH_VERSION << "\n";
return 0;
} else {
printHelp();
return 1;