Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: refactor version command #8027

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading