From 683d92a05f600c347433108f713c349507dccc18 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 10 Aug 2024 01:59:40 -0700 Subject: [PATCH] core/command: add --version --- src/core/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index c785f2f0..e48213ac 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -129,9 +129,10 @@ int qs_main(int argc, char** argv) { ->needs(debugPortArg); /// --- - bool sparseLogsOnly = false; + auto sparseLogsOnly = false; app.add_flag("--info", printInfo, "Print information about the shell")->excludes(debugPortArg); app.add_flag("--no-color", noColor, "Do not color the log output. (Env:NO_COLOR)"); + auto* printVersion = app.add_flag("-V,--version", "Print quickshell's version, then exit."); app.add_flag( "--no-detailed-logs", @@ -163,7 +164,10 @@ int qs_main(int argc, char** argv) { // Start log manager - has to happen with an active event loop or offthread can't be started. LogManager::init(!noColor, sparseLogsOnly); - if (*readLog) { + if (*printVersion) { + std::cout << "quickshell pre-release, revision: " << GIT_REVISION << std::endl; + return 0; + } if (*readLog) { auto file = QFile(*logPath); if (!file.open(QFile::ReadOnly)) { qCritical() << "Failed to open log for reading:" << *logPath;