spring-shell icon indicating copy to clipboard operation
spring-shell copied to clipboard

Preserve newlines when using single-quotes

Open runabol opened this issue 6 years ago • 2 comments

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?

runabol avatar Oct 19 '18 14:10 runabol

This bit me as well. I'm using 2.0.1.RELEASE.

jlevy-bigfootbiomedical avatar Apr 02 '19 17:04 jlevy-bigfootbiomedical

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.

micaelcapitao avatar Mar 06 '20 14:03 micaelcapitao