spring-shell
spring-shell copied to clipboard
Feature Request: Tell Spring Shell to ignore command line arguments
Context: I am developing a spring shell application. I want to be able to pass Spring ConfigurationProperties via the command line to the application.
Problem: The problem is that if I try to pass the ConfigurationProperties via the command line e.g.:
java -jar myapp.jar --flag1=value1 --flag2=value2
Spring Boot correctly parses --flag1=value1 --flag2=value2 as external configuration but then Spring shell tries to interpret
--flag1=value1 --flag2=value2
as a shell command which it is not.
Please provide a solution to this problem.
SO question: https://stackoverflow.com/questions/77462680/how-to-tell-spring-shell-to-not-parse-command-line-arguments-as-shell-commands
Duplicate of #508
I was able to solve this with a workaround as suggested in the abovementioned SO post, specifically by configuring a custom ShellRunner that decorates the given ShellRunner-implementation and simply filtering the args passed to the run -Method of the decorated ShellRunner-implementation.
However, I think it should be possible to filter args automatically by utilising the CommandCatalog, passing only those args to the shell that match a command or an option registered in the CommandCatalog.
Any thoughts on that idea by the maintainers? I could probably provide a PR.