xca/xcadoc.cpp
Christian Hohnstädt 68273d0a30 Switch from autotools/qmake to cmake
Why?
 - QT will switch from qmake to cmake sooner or later.
 - autotools are good for unix-ish systems, cmake also for
   macOS and Xcode as well as Windows and VS-code
 - Cross compiling the windows-binaries on linux
   is not very helpful to attract windows-centric
   developers.

Also drop qmake's xca.pro
Generate man-page and sphinx sources of commandline arguments
during build by executing xca (xcadoc.cpp).
Generating Version-patchlevel and git hash is now also
OS independent.
2021-06-01 17:48:37 +02:00

31 lines
578 B
C++

#include <iostream>
#include <QString>
#include <QFile>
#include "arguments.h"
using namespace std;
int main(int argc, char *argv[])
{
if (argc < 2) {
cerr << "Need type argument: <man|rst|completion>" << endl;
return EXIT_FAILURE;
}
QString doc = arguments::doc(argv[1]);
if (doc.isEmpty()) {
cerr << "Doc was empty: " << argv[1] << endl;
return EXIT_FAILURE;
}
if (argc == 2) {
cout << doc.toUtf8().constData() << endl;
return EXIT_SUCCESS;
}
QFile f(argv[2]);
f.open(QIODevice::WriteOnly);
f.write(doc.toUtf8());
f.close();
return EXIT_SUCCESS;
}