File tree Expand file tree Collapse file tree 3 files changed +63
-0
lines changed
Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ # Create kshell terminals from a kscript
2+
3+
4+ Based on https://github.com/khud/sparklin which is a proof-of-concept software that includes experimental new Kotlin REPL.
5+
6+ ## Installation
7+
8+ ``` bash
9+ wget https://raw.githubusercontent.com/holgerbrandl/kscript/master/misc/kshell_launcher/kshell_from_kscript.sh
10+ chmod +x kshell_from_kscript.sh
11+ ```
12+
13+ You may want to add it to your ` PATH ` as well.
14+
15+ ## Usage
16+
17+ Simply provide any kscript as argument. E.g [ ` krangl_example.kts ` ] ( )
18+ ```
19+ kshell_from_kscript.sh krangl_example.kts
20+ ```
21+
22+ ## Todo
23+
24+ * bundle this with kscript itself
Original file line number Diff line number Diff line change 1+ @file:DependsOn(" com.offbytwo:docopt:0.6.0.20150202" , " log4j:log4j:1.2.14" )
2+ @file:DependsOn(" de.mpicbg.scicomp:krangl:0.9.1" )
3+
4+ import krangl.flightsData
5+ import krangl.schema
6+
7+
8+ flightsData.schema()
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+
4+ if [ $# -ne 1 ]; then
5+ echo " Usage: kshell_from_kscript.sh <kscript.kts>"
6+ exit 0
7+ fi
8+
9+ tmpfile=$( mktemp) .kts
10+
11+ echo ' @file:Include("https://git.io/fAJ5h")' >> $tmpfile
12+ echo ' ' >> $tmpfile
13+
14+ argScript=$1
15+ # argScript=krangl_example.kts
16+
17+ cat $argScript >> $tmpfile
18+
19+ # cat $tmpfile
20+
21+
22+ echo " Preparing interactive session by resolving script dependencies..."
23+
24+ # # resolve dependencies without running the kscript
25+ KSCRIPT_DIR=$( dirname $( which kscript) )
26+ kscript_nocall () { kotlin -classpath ${KSCRIPT_DIR} /kscript.jar kscript.app.KscriptKt " $@ " ; }
27+
28+ kshellCP=$( kscript_nocall $tmpfile | cut -d' ' -f4)
29+
30+ # # create new
31+ exec java -classpath " ${kshellCP} " sparklin.kshell.KotlinShell $@
You can’t perform that action at this time.
0 commit comments