spring-projects / spring-shell

Spring based shell
http://projects.spring.io/spring-shell/
Apache License 2.0
723 stars 395 forks source link

Document Global help options with dynamic commands #627

Open jvalkeal opened 1 year ago

jvalkeal commented 1 year ago

If registering CommandRegistration into a catalog without defining help options like what happens here:

https://github.com/spring-projects/spring-shell/blob/25d249c28dfa37447a3e88bb699afafd3c52107d/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/CommandCatalogAutoConfiguration.java#L72-L76

that command obviously will not get customised. Should find a good way to also customise dynamic commands.

jvalkeal commented 1 year ago

I'm leaning towards this being a documentation issue. If manually creating command registrations and then registering those into a catalog where a past beyond a point where shell core can modify given registrations. Currently how these global help options work is that a singleton global instance of a registration builder is prepared for help options and user can choose or not to choose to use it.

For example in samples and how it's documented is that you autowire CommandRegistration.BuilderSupplier which is a global singleton which already knows about these prepared customisations.

jvalkeal commented 1 year ago

Reference for this is this commit from spring-cli https://github.com/spring-projects-experimental/spring-cli/commit/cf6cb3b37de05f602aef29672e2df606f93e3bd1