Browse Source

Printing input arguments before "Hello world" in the BasicCLI template, so that once can start a new project by test calling it with mockup arguments.

David Piuva 3 years ago
parent
commit
c47df2aba4
2 changed files with 14 additions and 1 deletions
  1. 4 0
      Source/templates/basicCLI/main.cpp
  2. 10 1
      Source/tools/wizard/main.cpp

+ 4 - 0
Source/templates/basicCLI/main.cpp

@@ -7,6 +7,10 @@ using namespace dsr;
 
 
 DSR_MAIN_CALLER(dsrMain)
 DSR_MAIN_CALLER(dsrMain)
 void dsrMain(List<String> args) {
 void dsrMain(List<String> args) {
+	// Printing any input arguments after the program.
+	for (int i = 1; i < args.length(); i++) {
+		printText(U"args[", i, U"] = ", args[i], U"\n");
+	}
 	// Printing some text to the terminal.
 	// Printing some text to the terminal.
 	printText(U"Hello world\n");
 	printText(U"Hello world\n");
 }
 }

+ 10 - 1
Source/tools/wizard/main.cpp

@@ -243,8 +243,17 @@ void dsrMain(List<String> args) {
 				// Could not find the application.
 				// Could not find the application.
 				component_setProperty_string(descriptionLabel, U"Text", string_combine(U"Could not find the executable at ", projects[projectIndex].executableFilePath, U"!\n"), true);
 				component_setProperty_string(descriptionLabel, U"Text", string_combine(U"Could not find the executable at ", projects[projectIndex].executableFilePath, U"!\n"), true);
 			} else if (process_getStatus(projects[projectIndex].programHandle) != DsrProcessStatus::Running) {
 			} else if (process_getStatus(projects[projectIndex].programHandle) != DsrProcessStatus::Running) {
+				// Select input arguments.
+				List<String> arguments;
+				if (string_match(projects[projectIndex].title, U"BasicCLI")) {
+					// Give some random arguments to the CLI template, so that it will do something more than just printing "Hello World".
+					arguments.push(U"1");
+					arguments.push(U"TWO");
+					arguments.push(U"three");
+					arguments.push(U"Four");
+				}
 				// Launch the application.
 				// Launch the application.
-				projects[projectIndex].programHandle = process_execute(projects[projectIndex].executableFilePath, List<String>());
+				projects[projectIndex].programHandle = process_execute(projects[projectIndex].executableFilePath, arguments);
 				updateInterface(true);
 				updateInterface(true);
 			}
 			}
 		}
 		}