Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Tell Spring Shell to ignore command line arguments #994

Open
siddhsql opened this issue Jan 27, 2024 · 2 comments
Open
Labels
status/duplicate There were an existing issue

Comments

@siddhsql
Copy link

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

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label Jan 27, 2024
@jvalkeal jvalkeal added status/duplicate There were an existing issue and removed status/need-triage Team needs to triage and take a first look labels Jan 28, 2024
@jvalkeal
Copy link
Contributor

Duplicate of #508

@jvalkeal jvalkeal marked this as a duplicate of #508 Jan 28, 2024
@MirkoDostmann
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/duplicate There were an existing issue
Projects
None yet
Development

No branches or pull requests

3 participants