You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inlined _kscripts_ are also cached based on `md5` checksum, so running the same snippet again will use a cached jar (sitting in `~/.kscript`).
133
133
134
134
135
-
Support API
136
-
-----------
137
-
138
-
139
-
`kscript` is complemented by a [support library](https://github.com/holgerbrandl/kscript-support-api) to ease the writing of Kotlin scriptlets. The latter includes solutions to common use-cases like argument parsing, data streaming, IO utilities, and various iterators to streamline the development of kscript applications.
140
-
141
-
When using the direct script arguments (like in the example below) the methods in the the `kscript.*` namespace and the corresponding dependency `com.github.holgerbrandl:kscript:1.2.1` are automatically added as prefix to the script by convention. This allows for sed-like constructs like
The elements that come from our support library in the example are the [`stdin`](https://github.com/holgerbrandl/kscript-support-api/blob/master/src/main/kotlin/kscript/StreamUtil.kt#L11) object of type `Sequence<String>` to iterate over the standard input, and the extension method [`print`](https://github.com/holgerbrandl/kscript-support-api/blob/master/src/main/kotlin/kscript/StreamUtil.kt#L34) to print the lines to stdout. The rest is stdlib Kotlin.
148
-
149
-
For more examples using the support library see this [blog post](http://holgerbrandl.github.io/kotlin/2017/05/08/kscript_as_awk_substitute.html).
150
-
151
-
152
-
Tool repositories
153
-
-----------------
135
+
URL usage
136
+
---------
154
137
155
138
To support remote scriplet repositories, `kscript` can also work with URLs. Consider the following [hello-world-gist-scriptlet](https://github.com/holgerbrandl/kscript/blob/master/examples/url_example.kts) which is hosted on github (but any URL would work). To run it locally as a tool simply refer to it (here using the shortened [raw-URL](https://raw.githubusercontent.com/holgerbrandl/kscript/master/examples/url_example.kts) of the script for better readability)
156
139
@@ -170,6 +153,23 @@ URL-scripts are cached locally to speed up processing, and `kscript --clear-cach
170
153
See this [blogpost](http://holgerbrandl.github.io/kotlin/2016/12/02/mini_programs_with_kotlin.html) for a more extensive overview about URL support in `kscript`.
171
154
172
155
156
+
Support API
157
+
-----------
158
+
159
+
160
+
`kscript` is complemented by a [support library](https://github.com/holgerbrandl/kscript-support-api) to ease the writing of Kotlin scriptlets. The latter includes solutions to common use-cases like argument parsing, data streaming, IO utilities, and various iterators to streamline the development of kscript applications.
161
+
162
+
When using the direct script arguments (like in the example below) the methods in the the `kscript.*` namespace and the corresponding dependency `com.github.holgerbrandl:kscript:1.2.1` are automatically added as prefix to the script by convention. This allows for sed-like constructs like
The elements that come from our support library in the example are the [`stdin`](https://github.com/holgerbrandl/kscript-support-api/blob/master/src/main/kotlin/kscript/StreamUtil.kt#L11) object of type `Sequence<String>` to iterate over the standard input, and the extension method [`print`](https://github.com/holgerbrandl/kscript-support-api/blob/master/src/main/kotlin/kscript/StreamUtil.kt#L34) to print the lines to stdout. The rest is stdlib Kotlin.
169
+
170
+
For more examples using the support library see this [blog post](http://holgerbrandl.github.io/kotlin/2017/05/08/kscript_as_awk_substitute.html).
0 commit comments