mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
print version on --version switch
This commit is contained in:
parent
05bcf22af4
commit
594c0fb255
4 changed files with 17 additions and 1 deletions
|
@ -10,6 +10,10 @@ Args::Args(const QStringList &args)
|
|||
{
|
||||
this->crashRecovery = true;
|
||||
}
|
||||
else if (arg == "--version")
|
||||
{
|
||||
this->printVersion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
/// Command line arguments passed to Chatterino.
|
||||
|
@ -8,6 +10,7 @@ class Args
|
|||
public:
|
||||
Args(const QStringList &args);
|
||||
|
||||
bool printVersion{};
|
||||
bool crashRecovery{};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
#define CHATTERINO_VERSION "2.1.5"
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -1,4 +1,6 @@
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
#include <memory>
|
||||
|
||||
|
@ -6,6 +8,7 @@
|
|||
#include "RunGui.hpp"
|
||||
#include "common/Args.hpp"
|
||||
#include "common/Modes.hpp"
|
||||
#include "common/Version.hpp"
|
||||
#include "singletons/Paths.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/IncognitoBrowser.hpp"
|
||||
|
@ -20,15 +23,19 @@ int main(int argc, char **argv)
|
|||
auto args = QStringList();
|
||||
std::transform(argv + 1, argv + argc, std::back_inserter(args),
|
||||
[&](auto s) { return s; });
|
||||
initArgs(args);
|
||||
|
||||
// run in gui mode or browser extension host mode
|
||||
if (shouldRunBrowserExtensionHost(args))
|
||||
{
|
||||
runBrowserExtensionHost();
|
||||
}
|
||||
else if (getArgs().printVersion)
|
||||
{
|
||||
qInfo().noquote() << Version::getInstance().getFullVersion();
|
||||
}
|
||||
else
|
||||
{
|
||||
initArgs(args);
|
||||
Paths *paths{};
|
||||
|
||||
try
|
||||
|
@ -60,4 +67,5 @@ int main(int argc, char **argv)
|
|||
|
||||
runGui(a, *paths, settings);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue