@@ -129,10 +129,13 @@ int main(int argc, char *argv[])
129129 " , to save the generated JavaScript or Python code." )
130130 , " path-to-save-code" , QString ());
131131 QCommandLineOption generateModeOption (" generate-mode" , QObject::tr (" Select \" python\" or \" javascript\" ." )
132- , " generate-mode" , " python " );
132+ , " generate-mode" , " javascript " );
133133 QCommandLineOption directScriptExecutionPathOption (" script-path"
134134 , QObject::tr (" The path to the Python or JavaScript file that will be used for interpretation." )
135135 , " script-path" , QString ());
136+ QCommandLineOption onlyGenerateOption (" only-generate"
137+ , QObject::tr (" Do not run the interpretation in any mode, " \
138+ " this is a parameter that is only used to generate a file." ));
136139 parser.addOption (backgroundOption);
137140 parser.addOption (reportOption);
138141 parser.addOption (trajectoryOption);
@@ -145,6 +148,7 @@ int main(int argc, char *argv[])
145148 parser.addOption (generatePathOption);
146149 parser.addOption (generateModeOption);
147150 parser.addOption (directScriptExecutionPathOption);
151+ parser.addOption (onlyGenerateOption);
148152 parser.process (*app);
149153 const QStringList positionalArgs = parser.positionalArguments ();
150154 if (positionalArgs.size () != 1 ) {
@@ -162,12 +166,14 @@ int main(int argc, char *argv[])
162166 const QString generatePath = parser.value (generatePathOption);
163167 const QString generateMode = parser.value (generateModeOption);
164168 const QString scriptFilePath = parser.value (directScriptExecutionPathOption);
169+ const bool onlyGenerate = parser.isSet (onlyGenerateOption);
165170
166171 QScopedPointer<twoDModel::Runner> runner (new twoDModel::Runner (report, trajectory, input, mode, qrsFile));
167172 auto speedFactor = parser.value (speedOption).toInt ();
168173
169174 if (!generatePath.isEmpty ()) {
170- if (generateMode != " python" and generateMode != " javascript" ) {
175+ if (generateMode != " python" and generateMode != " javascript"
176+ and generateMode != " nxt" ) {
171177 parser.showHelp ();
172178 QLOG_ERROR () << " Problem with generate code to " << generatePath;
173179 return TWO_D_MODEL_RUNNER_GENERATE_MODE_NOT_EXIST;
@@ -178,6 +184,10 @@ int main(int argc, char *argv[])
178184 }
179185 }
180186
187+ if (onlyGenerate || mode == " nxt" ) {
188+ return 0 ;
189+ }
190+
181191 if (!runner->interpret (backgroundMode, speedFactor, closeOnFinishMode,
182192 closeOnSuccessMode, showConsoleMode, scriptFilePath)) {
183193 return TWO_D_MODEL_RUNNER_INTERPRET_ERROR;
0 commit comments