Big Chungus
12/30/2022, 5:02 PMktx
is npx
built for kotlin ecosystem. Currently it only supports running & installing kotlin scripts, but I do plan to add maven jar support in the future. 0.0.1
is the first developer preview release, so I'd very much appreciate any feedback I could get about its API, usage or just general usefulness.
Here's a one-liner to get it onto your unix system
curl <https://raw.githubusercontent.com/mpetuska/ktx/master/scripts/install.sh> | bash
mbonnin
12/30/2022, 5:35 PMmbonnin
12/30/2022, 5:35 PMBig Chungus
12/30/2022, 5:36 PMBig Chungus
12/30/2022, 5:36 PMmbonnin
12/30/2022, 5:41 PMBig Chungus
12/30/2022, 5:44 PMktx run <https://server.io/url/to/script.kts|https://server.io/url/to/script.kts>
(doesn't even need to have .kts extension as long as content is kotlin script)Big Chungus
12/30/2022, 5:44 PMmbonnin
01/02/2023, 12:49 PM/Users/mbonnin/.local/share/ktx/
but /Users/mbonnin/.ktx/
is sourced
β’ I'm guessing it requires a JVM installed, right?mbonnin
01/02/2023, 12:51 PMmbonnin
01/02/2023, 12:51 PM# default uses latest version
ktx run com.example:my-cli
# version can be specified explicitely
ktx run com.example:my-cli:1.0
Big Chungus
01/02/2023, 1:00 PMmbonnin
01/02/2023, 1:01 PMmbonnin
01/02/2023, 1:02 PMBig Chungus
01/02/2023, 1:02 PMA few more feedbacks:
on my M1 mac + zsh, ktx is installed to /Users/mbonnin/.local/share/ktx/ but /Users/mbonnin/.ktx/ is sourced
I'm guessing it requires a JVM installed, right?
That's expected. I'm trying to keep ktx itself and it's state separate. However the layout is not final yet, still experimenting with it. Also jvm is the only prerequisite, should probably mention it in the readme π
Big Chungus
01/02/2023, 1:03 PMmbonnin
01/02/2023, 1:03 PMmbonnin
01/02/2023, 1:04 PMkotlin
is a dependency too? In addition to a JVM?mbonnin
01/02/2023, 1:04 PMkotlin
if not found?Big Chungus
01/02/2023, 1:04 PMBig Chungus
01/02/2023, 1:04 PMmbonnin
01/02/2023, 1:04 PMmbonnin
01/02/2023, 1:04 PMBig Chungus
01/02/2023, 1:13 PM/Users/mbonnin/.local/share/ktx/.ktxrc
mbonnin
01/02/2023, 1:14 PM$ cat /Users/mbonnin/.local/share/ktx/.ktxrc
#!/usr/bin/env bash
if [[ -z "$KTX_HOME" ]]; then
KTX_HOME="$HOME/.ktx"
PATH="$KTX_HOME/bin:$PATH"
fi%
Big Chungus
01/02/2023, 1:15 PMmbonnin
01/02/2023, 1:15 PMKTX_HOME
is wrongmbonnin
01/02/2023, 1:15 PMmbonnin
01/02/2023, 1:16 PMif [[ -z "$KTX_HOME" ]]; then
KTX_HOME="$HOME/.local/share/ktx"
PATH="$KTX_HOME/bin:$PATH"
fi%
mbonnin
01/02/2023, 1:16 PMmbonnin
01/02/2023, 1:16 PM$ ls ~/.ktx
ls: /Users/mbonnin/.ktx: No such file or directory
Big Chungus
01/02/2023, 1:17 PMBig Chungus
01/02/2023, 1:17 PMBig Chungus
01/02/2023, 1:18 PMmbonnin
01/02/2023, 1:18 PMfirst run/install of a scriptThing is I can't run anything because
ktx
is not in my PATH by defaultmbonnin
01/02/2023, 1:19 PMexport PATH=$HOME/.local/share/ktx/bin:$PATH
manuallyBig Chungus
01/02/2023, 1:20 PMBig Chungus
01/02/2023, 1:20 PMBig Chungus
01/02/2023, 1:21 PMmbonnin
01/02/2023, 1:21 PM$ ls -al ~/.local/bin/ktx
lrwxr-xr-x 1 mbonnin staff 39 Jan 2 13:47 /Users/mbonnin/.local/bin/ktx -> /Users/mbonnin/.local/share/ktx/bin/ktx
mbonnin
01/02/2023, 1:21 PMmbonnin
01/02/2023, 1:22 PMI guess just adding ktx bin to path directly should be more reliable since we're sourcing shit anyways+1. I don't think you can expect anything besides /usr/bin to be in $PATH
Big Chungus
01/02/2023, 1:22 PMCLOVIS
01/03/2023, 2:47 PMkscript
?Big Chungus
01/03/2023, 2:49 PMBig Chungus
01/03/2023, 2:49 PMmbonnin
01/03/2023, 2:59 PMkscript
is also able to run download and cache remote scripts: https://github.com/kscripting/kscript#url-usagembonnin
01/03/2023, 3:00 PMCLOVIS
01/03/2023, 3:00 PMwget
+`java -jar` call, thoughmbonnin
01/03/2023, 3:01 PMCLOVIS
01/03/2023, 3:01 PMmbonnin
01/03/2023, 3:01 PMCLOVIS
01/03/2023, 3:02 PMmbonnin
01/03/2023, 3:02 PMmbonnin
01/03/2023, 3:02 PM.module
fileBig Chungus
01/03/2023, 3:03 PMmbonnin
01/03/2023, 3:03 PM-jvm
for an exampleCLOVIS
01/03/2023, 3:04 PMmbonnin
01/03/2023, 3:04 PM*.main.kts
, i.e. first party resolver. Maybe kscript
is a bit different)mbonnin
01/03/2023, 3:04 PM*.main.kts
, it's working really well for meCLOVIS
01/03/2023, 3:05 PMBig Chungus
01/03/2023, 3:05 PMktx install <https://host.com/my-script.main.kts|https://host.com/my-script.main.kts>
my-script arg1 arg2 #just works
Big Chungus
01/11/2023, 1:31 AM