File indexing completed on 2024-04-28 04:21:36

0001 /*
0002 * SPDX-FileCopyrightText: 1999 Matthias Elter <me@kde.org>
0003 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
0004 * SPDX-FileCopyrightText: 2015 Boudewijn Rempt <boud@valdyas.org>
0005 *
0006 *  SPDX-License-Identifier: GPL-2.0-or-later
0007 *
0008 *  This program is distributed in the hope that it will be useful,
0009 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0010 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0011 *  GNU General Public License for more details.
0012 *
0013 *  You should have received a copy of the GNU General Public License
0014 *  along with this program; if not, write to the Free Software
0015 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0016 */
0017 
0018 #include <QString>
0019 #include <QStringList>
0020 #include <QTextStream>
0021 #include <QCommandLineParser>
0022 
0023 #include <kritaversion.h>
0024 #include <kritagitversion.h>
0025 
0026 QTextStream& qStdOut()
0027 {
0028     static QTextStream ts( stdout );
0029     return ts;
0030 }
0031 
0032 extern "C" int main(int argc, char **argv)
0033 {
0034     QStringList argList;
0035     for (int i = 0; i < argc; i++) {
0036         argList << QString::fromLocal8Bit(argv[i]);
0037     }
0038 
0039     QCommandLineParser parser;
0040     QCommandLineOption verbose(QStringList() << "v" << "verbose" << "showhash");
0041     parser.addOption(verbose);
0042     parser.process(argList);
0043 
0044     qStdOut() << KRITA_VERSION_STRING;
0045 #ifdef KRITA_GIT_SHA1_STRING
0046     if (parser.isSet(verbose)) {
0047         qStdOut() << " " << KRITA_GIT_SHA1_STRING;
0048     }
0049 #endif
0050     qStdOut() << "\n";
0051     return 0;
0052 }