File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ KSCRIPT_VERSION=1.0
66# # Show basic CLI description if no arguments are provided
77if [ $# == 0 ] || [ $1 == " -v" ] || [ $1 == " --version" ] || [ $1 == " -h" ] || [ $1 == " --help" ]; then
88 echo " Usage : kscript <scriptfile or - for stdin> [<script_args>]*" >&2
9+ echo " Usage : kscript --clear-jar-cache" >&2
910 echo " " >&2
1011 echo " Easy-to-use scripting support for Kotlin on *nix-based systems." >&2
1112 echo " " >&2
@@ -16,6 +17,12 @@ if [ $# == 0 ] || [ $1 == "-v" ] || [ $1 == "--version" ] || [ $1 == "-h" ] ||
1617 exit 1;
1718fi
1819
20+ # # optionally clear up jar cache
21+ if [ $1 == " --clear-jar-cache" ]; then
22+ echo " Cleaning up jar cache..."
23+ rm ${TMPDIR} /.kscript* jar
24+ exit 0
25+ fi
1926
2027# # ... or use a cached version of it if possible
2128# scriptFile="./test.kts"
@@ -37,8 +44,7 @@ if [ "$scriptFile" == "-" ]; then scriptFile="/dev/stdin"; fi
3744# https://viewsby.wordpress.com/2013/09/06/bash-string-ends-with/
3845
3946if [[ " $scriptFile " != * kts ]]; then
40- tmpScript=${TMPDIR=/ tmp} /kscript_stdin_$( mktemp -d XXXXXXXXX) .kts # odd but works on macos as well
41- # tmpScript=/tmp/kscript_stdin_$(mktemp -d XXXXXXXXX).kts # odd but works on macos as well
47+ tmpScript=${TMPDIR=/ tmp} /kscript_stdin_${RANDOM}${RANDOM} .kts # odd but works on macos as well
4248 cat " ${scriptFile} " > ${tmpScript}
4349
4450 # # rename to use checksum as name to allow for jar-caching also when using stdin
You can’t perform that action at this time.
0 commit comments