Skip to content

Commit 3e6df07

Browse files
committed
reordered sections in README
1 parent 7636570 commit 3e6df07

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,25 +132,8 @@ kscript <(echo 'println("k-onliner")') arg1 arg2 arg3
132132
Inlined _kscripts_ are also cached based on `md5` checksum, so running the same snippet again will use a cached jar (sitting in `~/.kscript`).
133133

134134

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
142-
143-
```bash
144-
cat some_file | kscript 'stdin.filter { "^de0[-0]*".toRegex().matches(it) }.map { it + "foo:" }.print()'
145-
```
146-
147-
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+
---------
154137

155138
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)
156139

@@ -170,6 +153,23 @@ URL-scripts are cached locally to speed up processing, and `kscript --clear-cach
170153
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`.
171154

172155

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
163+
164+
```bash
165+
cat some_file | kscript 'stdin.filter { "^de0[-0]*".toRegex().matches(it) }.map { it + "foo:" }.print()'
166+
```
167+
168+
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).
171+
172+
173173

174174
FAQ
175175
---

0 commit comments

Comments
 (0)