spring-shell
spring-shell copied to clipboard
Preserve newlines when using single-quotes
I have a use case where I want a user to be able to submit a YAML fragment to be executed by a remote server. I use Spring Shell 2.0.1.BUILD-SNAPSHOT
which provides support for multiline single-quotes input:
shell> create-job --pipeline '
quote> tasks:
quote> - type: print
quote> text: hello world
quote> '
But since Spring Shell trims the newline
character it arrives at my YAML parser as:
tasks: - type: print text: hello world
which is an invalid YAML document.
This seems to be the offending line:
https://github.com/spring-projects/spring-shell/blob/3f8e8334ba15b74f38a235841f8bee0cf16081cd/spring-shell-core/src/main/java/org/springframework/shell/jline/JLineShellAutoConfiguration.java#L189
Any suggestions?
This bit me as well. I'm using 2.0.1.RELEASE.
Any workaround for this issue? I'm having a similar issue but in my case I want to allow users to paste json, with comments.