xca/lib/xcadoc.cpp
Christian Hohnstaedt bd61f44e02 Refactor source file inclusion
No libraries needed. Just put all files as source to xca
and those needed for xcadoc to the xcadoc target.
Github Action: create deployments for each matrix result
2022-09-07 20:01:25 +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;
}