File indexing completed on 2025-01-26 04:38:17

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "../githubauthenticationjob.h"
0008 #include <QCommandLineParser>
0009 #include <QGuiApplication>
0010 
0011 int main(int argc, char **argv)
0012 {
0013     QGuiApplication app(argc, argv);
0014     QCommandLineParser parser;
0015 
0016     const QCommandLineOption clientId(QStringList() << QStringLiteral("i") << QStringLiteral("client-id"),
0017                                       QStringLiteral("Specifies the application client id"),
0018                                       QStringLiteral("client_id"));
0019 
0020     parser.addOptions({clientId});
0021     parser.process(app);
0022 
0023     if (parser.isSet(clientId)) {
0024         const QString value = parser.value(clientId);
0025         auto job = new GitHubAuthenticationJob();
0026         GitHubAuthenticationJob::GitHubInfo info;
0027         info.url = QStringLiteral("foo");
0028         info.clientId = value;
0029         job->setGitHubInfo(std::move(info));
0030         job->start();
0031         app.exec();
0032     } else {
0033         parser.showHelp();
0034     }
0035     return 0;
0036 }