@@ -35,6 +35,7 @@ Use '--self-update' to wipe cached script jars and urls
3535
3636Options:
3737 -i --interactive Create interactive shell with dependencies as declared in script
38+ -t --text Enable stdin support API for more streamlined text processing
3839 --idea Open script in temporary Intellij session
3940
4041Copyright : 2017 Holger Brandl
@@ -86,7 +87,7 @@ fun main(args: Array<String>) {
8687
8788 // Resolve the script resource argument into an actual file
8889 val scriptResource = docopt.getString(" script" )
89- val scriptFile = prepareScript(scriptResource)
90+ val scriptFile = prepareScript(scriptResource, enableSupportApi = docopt.getBoolean( " text " ) )
9091
9192
9293 val scriptText = scriptFile.readLines()
@@ -263,7 +264,7 @@ private fun versionCheck() {
263264 }
264265}
265266
266- fun prepareScript (scriptResource : String ): File {
267+ fun prepareScript (scriptResource : String , enableSupportApi : Boolean ): File {
267268 var scriptFile: File ?
268269
269270 // map script argument to script file
@@ -304,7 +305,8 @@ fun prepareScript(scriptResource: String): File {
304305 var script = scriptResource.trim()
305306
306307 // auto-prefix one-liners with kscript-support api
307- if (numLines(script) == 1 && (script.startsWith(" lines" ) || script.startsWith(" stdin" ))) {
308+ // if (numLines(script) == 1 && (script.startsWith("lines") || script.startsWith("stdin"))) {
309+ if (enableSupportApi) {
308310 val prefix = """
309311 //DEPS com.github.holgerbrandl:kscript:1.2.2
310312
0 commit comments