aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bb58782..e1e7618 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -7,6 +7,7 @@
*/
#include "browser.h"
+#include "builtins.h"
#include "configuration.h"
#include "session/session.h"
#include "session/sessiondialog.h"
@@ -88,11 +89,6 @@ int main(int argc, char **argv)
// create and load configuration
std::unique_ptr<Configuration> config = std::make_unique<Configuration>(nullptr);
-#ifdef QT_DEBUG
- QObject::connect(config.get(), &Configuration::settingChanged, [](const std::string &path, const QString &value) {
- qDebug("!!! setting changed %s=[%s]", path.c_str(), qUtf8Printable(value));
- });
-#endif
if(!config->parse(argc, argv)) {
qWarning("Error parsing command line, check --help for usage.");
@@ -104,15 +100,12 @@ int main(int argc, char **argv)
// --version
if(config->exists("version")) {
- auto ver = QVersionNumber::fromString(QLatin1String(poi_Version));
- std::cout << "smolbote " << ver.toString().toStdString() << std::endl;
- return 0;
+ return builtins::version();
}
// --build
if(config->exists("build")) {
- std::cout << poi_Version << std::endl;
- return 0;
+ return builtins::build();
}
QVector<QPluginLoader *> plugins;
@@ -137,27 +130,8 @@ int main(int argc, char **argv)
}
if(config->exists("help")) {
- std::cout << "smolbote " << poi_Version << ": yet another no-frills browser" << std::endl;
- std::cout << "Usage: " << argv[0] << " [options] [command/URL(s)]" << std::endl
- << std::endl;
-
- std::cout << "Command-line Options: " << std::endl
- << config->commandlineOptions() << std::endl;
-
- std::cout << "Commands: " << std::endl;
- for(auto it = pluginCommands.constBegin(); it != pluginCommands.constEnd(); ++it) {
- std::cout << it.key().toStdString() << std::endl;
- }
- std::cout << std::endl;
-
- std::cout << "Configuration Options: " << std::endl
- << config->configurationOptions() << std::endl;
-#ifdef Q_OS_LINUX
- std::cout << std::endl
- << "For more information refer to the manual page smolbote.7" << std::endl;
-#endif
- return 0;
+ return builtins::help(argv[0], config->commandlineOptions(), config->configurationOptions(), pluginCommands);
}
// argc, argv, allowSecondary