print version on --version switch
This commit is contained in:
@@ -10,6 +10,10 @@ Args::Args(const QStringList &args)
|
|||||||
{
|
{
|
||||||
this->crashRecovery = true;
|
this->crashRecovery = true;
|
||||||
}
|
}
|
||||||
|
else if (arg == "--version")
|
||||||
|
{
|
||||||
|
this->printVersion = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
/// Command line arguments passed to Chatterino.
|
/// Command line arguments passed to Chatterino.
|
||||||
@@ -8,6 +10,7 @@ class Args
|
|||||||
public:
|
public:
|
||||||
Args(const QStringList &args);
|
Args(const QStringList &args);
|
||||||
|
|
||||||
|
bool printVersion{};
|
||||||
bool crashRecovery{};
|
bool crashRecovery{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#define CHATTERINO_VERSION "2.1.5"
|
#define CHATTERINO_VERSION "2.1.5"
|
||||||
|
|||||||
+9
-1
@@ -1,4 +1,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -6,6 +8,7 @@
|
|||||||
#include "RunGui.hpp"
|
#include "RunGui.hpp"
|
||||||
#include "common/Args.hpp"
|
#include "common/Args.hpp"
|
||||||
#include "common/Modes.hpp"
|
#include "common/Modes.hpp"
|
||||||
|
#include "common/Version.hpp"
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "util/IncognitoBrowser.hpp"
|
#include "util/IncognitoBrowser.hpp"
|
||||||
@@ -20,15 +23,19 @@ int main(int argc, char **argv)
|
|||||||
auto args = QStringList();
|
auto args = QStringList();
|
||||||
std::transform(argv + 1, argv + argc, std::back_inserter(args),
|
std::transform(argv + 1, argv + argc, std::back_inserter(args),
|
||||||
[&](auto s) { return s; });
|
[&](auto s) { return s; });
|
||||||
|
initArgs(args);
|
||||||
|
|
||||||
// run in gui mode or browser extension host mode
|
// run in gui mode or browser extension host mode
|
||||||
if (shouldRunBrowserExtensionHost(args))
|
if (shouldRunBrowserExtensionHost(args))
|
||||||
{
|
{
|
||||||
runBrowserExtensionHost();
|
runBrowserExtensionHost();
|
||||||
}
|
}
|
||||||
|
else if (getArgs().printVersion)
|
||||||
|
{
|
||||||
|
qInfo().noquote() << Version::getInstance().getFullVersion();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initArgs(args);
|
|
||||||
Paths *paths{};
|
Paths *paths{};
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -60,4 +67,5 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
runGui(a, *paths, settings);
|
runGui(a, *paths, settings);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user