File indexing completed on 2024-04-21 04:42:44

0001 /*
0002     SPDX-FileCopyrightText: 2018 Frederik Gladhorn <gladhorn@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include <QCoreApplication>
0008 #include <QCommandLineParser>
0009 #include <QTextStream>
0010 
0011 #include "dumper.h"
0012 
0013 int main(int argc, char** argv)
0014 {
0015     QCoreApplication app(argc, argv);
0016     app.setApplicationName(QStringLiteral("Accessibility Tree dumper"));
0017 
0018     QCommandLineParser p;
0019     p.addPositionalArgument(QStringLiteral("appname"), QStringLiteral("Application name"));
0020     QCommandLineOption states(QStringLiteral("states"));
0021     p.addOption(states);
0022 
0023     if (!p.parse(app.arguments())) {
0024         QTextStream out(stdout);
0025         out << QStringLiteral("Could not parse command line arguments.");
0026         out << p.helpText();
0027         exit(1);
0028     }
0029 
0030     Dumper d;
0031     if (p.isSet(states)) {
0032         d.showStates(true);
0033     }
0034 
0035     if (p.positionalArguments().size() == 1) {
0036         d.run(p.positionalArguments().at(0));
0037     } else {
0038         d.run(QString());
0039     }
0040 }