spring-projects / spring-shell

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

Preserve newlines when using single-quotes #237

Open runabol opened 5 years ago

runabol commented 5 years ago

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?

jlevy-bigfootbiomedical commented 5 years ago

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

micaelcapitao commented 4 years ago

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.