gnodet-bot commented on code in PR #29980:
URL: https://github.com/apache/camel/pull/29980#discussion_r4575357074
##########
dsl/camel-jbang/camel-jbang-run/src/main/java/org/apache/camel/dsl/jbang/run/KameletMainIntegration.java:
##########
@@ -177,6 +184,57 @@ private void ended(Integer exitCode, String failure) {
}
}
+ /**
+ * Why the run has no routes, with the YAML files it did not load: the
YAML DSL reads .yaml files, not .yml ones.
+ */
+ static String noRoutesMessage(RunRequest request) {
+ String where = request.sourceDir != null ? request.sourceDir :
String.join(", ", request.files);
+ String answer = where.isEmpty() ? "No routes found" : "No routes found
in: " + where;
+ List<String> yml = ymlFiles(request);
+ if (!yml.isEmpty()) {
+ answer += " (a YAML DSL file ends with .yaml, such as
routes.camel.yaml, so these are not loaded: "
+ + String.join(", ", yml) + ")";
+ }
+ return answer;
+ }
+
+ private static List<String> ymlFiles(RunRequest request) {
+ List<String> answer = new ArrayList<>();
+ if (request.sourceDir != null) {
+ Path dir = Paths.get(request.sourceDir);
+ try (Stream<Path> files = Files.walk(dir, 3)) {
Review Comment:
💡 **Nit:** `3` is a magic number here — a brief inline comment would help
future readers understand why depth 3 is the right bound (e.g. `// max depth:
src/group/file.yml`).
```suggestion
try (Stream<Path> files = Files.walk(dir, 3)) { // max walk depth:
matches src/group/file.yml structure
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]