Commit 4ec167a3 authored by Langella Olivier's avatar Langella Olivier
Browse files

introducing qcommandlineparser

parent f1eccb43
......@@ -20,6 +20,7 @@
#include "masschroq_cli.h"
#include <QDebug>
#include <QCommandLineParser>
......@@ -84,6 +85,12 @@ void masschroqCli::run()
const QDateTime dt_begin = QDateTime::currentDateTime();
const QString masschroq_dir_path(QCoreApplication::applicationDirPath());
QCommandLineParser parser;
parser.setApplicationDescription("Perform Mass Chromatogram Quantification as indicated in the XML input FILE.");
parser.addHelpOption();
parser.addVersionOption();
QStringList arguments = app->arguments();
QString fileName;
/// by default, temporary files go in the temporary directory of the system
......@@ -103,7 +110,7 @@ void masschroqCli::run()
switch (args_number) {
case 2 :
qDebug() << "masschroqml cli case 2";
qDebug() << "masschroqml cli case 2";
first = arguments.at(1);
if ( (first == "--help") ||
(first == "-h") )
......@@ -129,7 +136,7 @@ void masschroqCli::run()
break;
case 3 :
qDebug() << "masschroqml cli case 3";
qDebug() << "masschroqml cli case 3";
fileName = arguments.at(2);
option = arguments.at(1);
if ( (option == "--parse-peptides") ||
......@@ -152,7 +159,7 @@ void masschroqCli::run()
}
break;
case 4 :
qDebug() << "masschroqml cli case 4";
qDebug() << "masschroqml cli case 4";
option = arguments.at(1);
fileName = arguments.at(3);
......@@ -180,8 +187,8 @@ void masschroqCli::run()
break;
case 6 :
qDebug() << "masschroqml cli case 6";
option = arguments.at(1);
qDebug() << "masschroqml cli case 6";
option = arguments.at(1);
fileName = arguments.at(5);
if ( (option == "--tmpdir") ||
......@@ -229,14 +236,14 @@ void masschroqCli::run()
}
break;
case 1 :
qDebug() << "masschroqml cli case 1";
mcqerr() << "masschroq : missing input filename." << endl;
qDebug() << "masschroqml cli case 1";
mcqerr() << "masschroq : missing input filename." << endl;
mcqerr() << "Try 'masschroq --help' for more information." << endl;
windaube_exit();
app->exit(1);
break;
default :
qDebug() << "masschroqml cli default";
qDebug() << "masschroqml cli default";
mcqerr() << "masschroq : invalid use." << endl;
mcqerr() << "Try 'masschroq --help' for more information." << endl;
......@@ -256,14 +263,14 @@ void masschroqCli::run()
mass_chroq_engine.setXmlFilename(fileName);
if (masschroqml_validation == true) {
qDebug() << "masschroqml_validation == true";
qDebug() << "masschroqml_validation == true";
mass_chroq_engine.validateXmlFile();
// you must call quit when complete or the program will stay in the
// messaging loop
// quit();
// quit();
}
else {
qDebug() << "masschroqml_validation == false";
qDebug() << "masschroqml_validation == false";
mass_chroq_engine.setTmpDir(tmpDirName);
......@@ -304,10 +311,10 @@ void masschroqCli::run()
mcqerr() << error.qwhat() << endl;
windaube_exit();
exit(1);
exit(1);
app->exit(1);
}
qDebug() << "before final quit()";
qDebug() << "before final quit()";
// you must call quit when complete or the program will stay in the
// messaging loop
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment