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

   [CAMEL-26455](https://issues.apache.org/jira/browse/CAMEL-26455)
   
   Found with the golden test of what the CLI parses (#28791), on the way to 
the aesh port 
([CAMEL-23810](https://issues.apache.org/jira/browse/CAMEL-23810)).
   
   **The bug: `camel config set dev=true` is ignored.** picocli looks up a 
default from the user configuration only by the longest name of an option. 
`--reload,--dev` of `camel run` is set by `reload=true`, but `dev=true` and 
`camel.run.dev=true` did nothing. The same goes for every option with more than 
one long name (`--dep,--dependency`, `--dir,--directory`, ...). The provider 
now looks up every long name: first the command's own key (`camel.run.dev`), 
then the key for all commands (`dev`). The longest name still comes first, so a 
configuration that works today keeps working. The configuration docs now say 
what a key is.
   
   **Two option definitions cleaned up before the port:**
   - `camel dependency update` has its own positional target files, and also 
inherits the `<files>` of the export. picocli gives the files to both, and the 
command relied on that for its Java and route files. It now sets the files of 
the export from its target files. Nothing changes with picocli. With a parser 
that fills only the subclass field (as aesh does), the export would otherwise 
run without the files.
   - `camel dependency copy`: `--output-directory` was `required` next to its 
default `lib`. With picocli the default already satisfies `required`, so it did 
nothing. aesh reports such an option as missing.
   
   Tests:
   - `UserConfigDefaultsTest`: an option with two long names, and the command's 
key wins over the key for all commands.
   - `DependencyUpdateTest`: the update works when only the target files are 
given. It fails with the old code, which then exports "what was last run".
   - The golden file changes in only the case it recorded the bug in: 
`camel.run.dev=true` and `run` now give `dev=true`.
   - All camel-jbang-core tests pass locally (2448 + 290).
   
   The metadata JSON only loses `"required": true` for `--output-directory` 
(each command is on one line, so the diff looks large).
   
   _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]

Reply via email to