forked from quickshell/quickshell
core/command: add --version
This commit is contained in:
parent
14852700cb
commit
683d92a05f
1 changed files with 6 additions and 2 deletions
|
@ -129,9 +129,10 @@ int qs_main(int argc, char** argv) {
|
||||||
->needs(debugPortArg);
|
->needs(debugPortArg);
|
||||||
|
|
||||||
/// ---
|
/// ---
|
||||||
bool sparseLogsOnly = false;
|
auto sparseLogsOnly = false;
|
||||||
app.add_flag("--info", printInfo, "Print information about the shell")->excludes(debugPortArg);
|
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)");
|
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(
|
app.add_flag(
|
||||||
"--no-detailed-logs",
|
"--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.
|
// Start log manager - has to happen with an active event loop or offthread can't be started.
|
||||||
LogManager::init(!noColor, sparseLogsOnly);
|
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);
|
auto file = QFile(*logPath);
|
||||||
if (!file.open(QFile::ReadOnly)) {
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
qCritical() << "Failed to open log for reading:" << *logPath;
|
qCritical() << "Failed to open log for reading:" << *logPath;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue