Added help option
This commit is contained in:
parent
1ad927f8d1
commit
3fb63a2887
1 changed files with 4 additions and 3 deletions
|
@ -8,15 +8,16 @@
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
QCommandLineOption mtl_filepath_opt({"m", "material"}, "Material file path", "path");
|
QCommandLineOption mtl_filepath_opt({"m", "material"}, "Material file path, required", "path");
|
||||||
QCommandLineOption obj_filepath_opt({"o", "object"}, "Object file path", "path");
|
QCommandLineOption obj_filepath_opt({"o", "object"}, "Object file path, required", "path");
|
||||||
|
parser.addHelpOption();
|
||||||
parser.addOption(mtl_filepath_opt);
|
parser.addOption(mtl_filepath_opt);
|
||||||
parser.addOption(obj_filepath_opt);
|
parser.addOption(obj_filepath_opt);
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
QString mtl_filepath = parser.value(mtl_filepath_opt);
|
QString mtl_filepath = parser.value(mtl_filepath_opt);
|
||||||
QString obj_filepath = parser.value(obj_filepath_opt);
|
QString obj_filepath = parser.value(obj_filepath_opt);
|
||||||
if (mtl_filepath.isEmpty() || obj_filepath.isEmpty()) {
|
if (mtl_filepath.isEmpty() || obj_filepath.isEmpty()) {
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
QMainWindow w;
|
QMainWindow w;
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
|
|
Loading…
Reference in a new issue