diff options
author | davc0n <[email protected]> | 2024-10-08 12:42:51 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-08 11:42:51 +0100 |
commit | b3a7e3109bf2b7b4422424471130197dc08baeb1 (patch) | |
tree | d6e2af71cd5d7b18ffe25e6cfeabaaceaf9f9bea /src/main.cpp | |
parent | 45e82199fb29f422ebbbfe06ce03022dfb6d645e (diff) | |
download | Hyprland-b3a7e3109bf2b7b4422424471130197dc08baeb1.tar.gz Hyprland-b3a7e3109bf2b7b4422424471130197dc08baeb1.zip |
misc: refactor version command (#8027)
Fixes a minor spacing issue if git status is not dirty.
Additionally now should be easier to extend it eventually.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 279e1ce1..57bb5507 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,11 +116,20 @@ int main(int argc, char** argv) { return 0; } else if (it->compare("-v") == 0 || it->compare("--version") == 0) { + auto result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH; + auto dirty = std::string(GIT_DIRTY); + if (!dirty.empty()) + result += " " + dirty; + 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 + std::string{"\nbuilt against aquamarine "} + AQUAMARINE_VERSION + "\n" + - "\n\nflags: (if any)\n"; + result += " (" + commitMsg + ")."; + + result += "\nDate: " + std::string(GIT_COMMIT_DATE); + result += "\nTag: " + std::string(GIT_TAG) + ", commits: " + std::string(GIT_COMMITS); + result += "\nbuilt against aquamarine " + std::string(AQUAMARINE_VERSION); + + result += "\n\nflags: (if any)\n"; #ifdef LEGACY_RENDERER result += "legacyrenderer\n"; |