File indexing completed on 2024-04-28 05:34:59

0001 /*
0002     SPDX-FileCopyrightText: 2021 David Edmundson <davidedmundson@kde.org>
0003     SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "interactiveconsole.h"
0008 #include <QApplication>
0009 #include <QCommandLineParser>
0010 #include <QDebug>
0011 
0012 int main(int argc, char **argv)
0013 {
0014     QApplication app(argc, argv);
0015     InteractiveConsole::ConsoleMode mode = InteractiveConsole::PlasmaConsole;
0016 
0017     QCommandLineParser parser;
0018     QCommandLineOption plasmaOpt(QStringLiteral("plasma"));
0019     QCommandLineOption kwinOpt(QStringLiteral("kwin"));
0020     parser.addOption(plasmaOpt);
0021     parser.addOption(kwinOpt);
0022     parser.addHelpOption();
0023     parser.process(app);
0024     if (parser.isSet(plasmaOpt) && parser.isSet(kwinOpt)) {
0025         qWarning() << "Only one mode can be specified when launching the interactive console";
0026         exit(1);
0027     } else if (parser.isSet(kwinOpt)) {
0028         mode = InteractiveConsole::KWinConsole;
0029     } else if (parser.isSet(plasmaOpt)) {
0030         mode = InteractiveConsole::PlasmaConsole;
0031     }
0032     // set to delete on close
0033     auto console = new InteractiveConsole(mode);
0034     console->show();
0035     return app.exec();
0036 }