davsclaus opened a new pull request, #27995: URL: https://github.com/apache/camel/pull/27995
As decided on [CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688): **`camel init` fails when the file exists, and `--force` overwrites it.** ### The change `camel init my.camel.yaml` overwrote `my.camel.yaml` when it existed already, such as a route someone had been working on, without a word. Now: - it exits with `1` and prints `ERROR: File already exists: <file> (use --force to overwrite it)` on stderr, and leaves the file as it is; - the new boolean option `--force` overwrites it (named as in `jbang init --force`); - the files `camel init` downloads from GitHub or a gist are all resolved and checked before any is written, so a conflict never leaves half of them; - `--clean-dir` still empties the directory first, so the file is then not there to conflict. ### Tests `InitTest`: a file that exists is not overwritten (exit `1`, the error, the content kept), and `--force` overwrites it with the template. The command docs are regenerated (`--force`), and the change is in the 4.24 upgrade guide. `mvn test` of `InitTest` in camel-jbang-core: all pass (17). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My -- 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]
