From 3fb63a288743881343098b0f9de6f23d6610b641 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 4 May 2023 16:27:32 +0500 Subject: [PATCH] Added help option --- src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3a540c9..319368e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,15 +8,16 @@ int main(int argc, char **argv) { QApplication app(argc, argv); QCommandLineParser parser; - QCommandLineOption mtl_filepath_opt({"m", "material"}, "Material file path", "path"); - QCommandLineOption obj_filepath_opt({"o", "object"}, "Object file path", "path"); + QCommandLineOption mtl_filepath_opt({"m", "material"}, "Material file path, required", "path"); + QCommandLineOption obj_filepath_opt({"o", "object"}, "Object file path, required", "path"); + parser.addHelpOption(); parser.addOption(mtl_filepath_opt); parser.addOption(obj_filepath_opt); parser.process(app); QString mtl_filepath = parser.value(mtl_filepath_opt); QString obj_filepath = parser.value(obj_filepath_opt); if (mtl_filepath.isEmpty() || obj_filepath.isEmpty()) { - return -1; + return 1; } QMainWindow w; Ui::MainWindow ui;