Skip to content

Commit 683d92a

Browse files
committed
core/command: add --version
1 parent 1485270 commit 683d92a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ int qs_main(int argc, char** argv) {
129129
->needs(debugPortArg);
130130

131131
/// ---
132-
bool sparseLogsOnly = false;
132+
auto sparseLogsOnly = false;
133133
app.add_flag("--info", printInfo, "Print information about the shell")->excludes(debugPortArg);
134134
app.add_flag("--no-color", noColor, "Do not color the log output. (Env:NO_COLOR)");
135+
auto* printVersion = app.add_flag("-V,--version", "Print quickshell's version, then exit.");
135136

136137
app.add_flag(
137138
"--no-detailed-logs",
@@ -163,7 +164,10 @@ int qs_main(int argc, char** argv) {
163164
// Start log manager - has to happen with an active event loop or offthread can't be started.
164165
LogManager::init(!noColor, sparseLogsOnly);
165166

166-
if (*readLog) {
167+
if (*printVersion) {
168+
std::cout << "quickshell pre-release, revision: " << GIT_REVISION << std::endl;
169+
return 0;
170+
} if (*readLog) {
167171
auto file = QFile(*logPath);
168172
if (!file.open(QFile::ReadOnly)) {
169173
qCritical() << "Failed to open log for reading:" << *logPath;

0 commit comments

Comments
 (0)