davsclaus opened a new pull request, #28798:
URL: https://github.com/apache/camel/pull/28798

   [CAMEL-26467](https://issues.apache.org/jira/browse/CAMEL-26467)
   
   The exit codes of the Camel CLI (CAMEL-25388, new in 4.24) follow the Linux 
conventions, so a script or an AI agent can read them without the docs. One 
code did not: `3` "not found" covered two cases.
   - A name that is not running or not there (an integration, route, service, 
plugin, catalog entry or config key) fits the LSB convention: `systemctl 
status` gives `3` for a service that is not running. This keeps `3`.
   - A file or directory given on the command line that does not exist, or 
holds none of the files the command needs, has no convention behind `3`. It now 
exits with `66`, `EX_NOINPUT` from `sysexits.h`, the standard code for missing 
input.
   
   4.24 is not released yet, so no user relies on `3` for a file.
   
   **What changes:**
   - `CliExitCode.FILE_NOT_FOUND = 66` and `CliException.fileNotFound(...)`.
   - `66` replaces `3` for the source files and `--source-dir` of `camel run`, 
the files of `camel explain`, `camel harden`, `camel dependency update`, `camel 
transform message`, `camel transform dataweave` and `camel eval expression 
--template=file:`, and the source files of `camel cmd route-diagram`, 
`route-structure` and `route-topology`. The same goes for the directory of 
`camel overview`, the `pom.xml` of `camel dependency runtime` and `camel update 
run`, the input of `camel generate rest`, and "no YAML/properties files to 
validate". A `NoSuchFileException` that reaches the error handler also gives 
`66`.
   - The `3` cases are unchanged: a running integration, route, endpoint, 
trace, service, pod, plugin, Kamelet name, catalog entry, config key, or the 
class of `camel generate schema`.
   - `camel --help` (the exit code list), the description of the CLI tool that 
`camel ask` gives the model, the exit codes page and the 4.24 upgrade guide 
list `66`.
   
   **One case to look at:** `camel cmd route-diagram foo`, where `foo` matches 
neither a running integration nor a file, now exits with `66`, as its message 
says `File does not exist: foo`.
   
   **Tests:** I updated the tests that check a missing file (21 assertions) and 
added `66` to the codes that `ExitCodeContractTest` passes through. The tests 
of camel-jbang-run, camel-jbang-core (2448 + 290), generate and validate pass. 
The two `DoctorRepositoryTest` tests fail only with a scratch Maven repository 
(`-Dmaven.repo.local`), the same as on `main`.
   
   When the CLI moves to aesh (CAMEL-23810), aesh's `127` for an unknown 
command is mapped to `2`: `127` belongs to the shell (`camel` not on the 
`PATH`), and git and kubectl also answer an unknown sub-command with a usage 
error.
   
   _Claude Code on behalf of davsclaus (Claus Ibsen)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_0128ThHB3iQdrvSRLVBGRrdP
   


-- 
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]

  • [PR] CAMEL-26467: camel-jbang... davsclaus (via GitHub) via commits

Reply via email to