davsclaus opened a new pull request, #29965: URL: https://github.com/apache/camel/pull/29965
Found while testing `--exclude` for item 6 of [CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930), and filed with its other run issues (item 7). ## Problem `camel run *` works because a Unix shell expands the `*` before the CLI sees it. A shell that passes the wildcard on, such as the Windows command prompt, or a quoted `'*'`, gave the CLI the `*` itself: ``` $ camel run '*' ERROR: No routes found in: * exit 1 $ camel run '*.camel.yaml' ERROR: File not found: Source file '*.camel.yaml' does not exist exit 66 $ camel run 'sub/*.yaml' ERROR: File not found: Source file 'sub/*.yaml' does not exist exit 66 ``` ## Change `Run.expandWildcards` expands a local file name with `*` or `?` in its name (not in its folder) to the files and folders it matches, sorted, as a shell does: a hidden file matches only a wildcard that starts with a dot, and a folder is left out later as with `camel run *`. A wildcard that matches nothing exits with 66, "No file matches: *.xml". A `file:` resource pattern and a remote file, such as `github:...:jbang/*`, are left as given. On the launcher, in a folder with `a.camel.yaml`, `skip.camel.yaml` and `sub/`: ``` camel run '*' a skip camel run '*.camel.yaml' --exclude=skip.camel.yaml a camel run 'sub/*.yaml' sub/b sub/skip2 camel run '*.xml' ERROR: No file matches: *.xml exit 66 ``` ## Tests - `RunWildcardTest` (new): `*` is the files of the folder, sorted, without a hidden file; `*.yaml` and `?`; other files, `github:` and `file:` are left as given; no match exits 66. - camel-jbang-core: 3073 + 264 pass (`DependencyUpdateTest` flaked once and passed on the rerun). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
