- Android
- Kotlin Native
- Kotlin Multiplatform
- Kotlin/JS
- Kotlin/Multiplatform
- Gradle
- For whatever reason I've graduated in Bsc Economics...
npx for kotlin and the JVM! Install and execute jars or kotlin scripts just like any other command line utility.
License: Apache License 2.0
Distribute via sdkman. We'll need to figure out how to persist scripts between version updates since sdkman only adds package bin directory to path.
https://github.com/sdkman/sdkman-cli/wiki/Vendor-onboarding-process
Make sure execute
command treats all arguments as positional.
Hi @mpetuska!
I'm giving ktx a try by running:
> ktx install https://raw.githubusercontent.com/krzema12/PersonalConfigs/master/scripts/removeLocalMergedBranches.main.kts --alias=remove-merged-branches
It's a script I've been using for a year now.
This installation completes with success - nothing on stdout, 0 exit code.
Checking ~/.ktx
dir:
> ll ~/.ktx/bin
total 0
lrwxr-xr-x 1 piotr staff 60B Jan 19 09:13 remove-merged-branches@ -> /Users/piotr/.ktx/scripts/removeLocalMergedBranches.main.kts
> head /Users/piotr/.ktx/scripts/removeLocalMergedBranches.main.kts
#!/usr/bin/env -S ktx execute
@file:DependsOn("org.eclipse.jgit:org.eclipse.jgit:4.6.0.201612231935-r")
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.ListBranchCommand
import java.io.File
import kotlin.system.exitProcess
fun red(text: String) = "\u001B[31m$text\u001B[0m"
Everything looks as expected.
I'd expect that calling remove-merged-branches
runs the script, but it doesn't work:
-bash: remove-merged-branches: command not found
Let's try to call the symlinked script:
> ~/.ktx/bin/remove-merged-branches
Removing /Users/piotr/.ktx/bin/remove-merged-branches due to incompatibility with [email protected]. Please reinstall it.
Usage: ktx execute [OPTIONS] TARGET [ARGS]...
Error: Invalid value for "TARGET": File "/Users/piotr/.ktx/bin/remove-merged-branches" does not exist.
Also, the symlink disappeared:
> ll ~/.ktx/bin
total 0
I'm on MacBook Pro M2, Ventura 13.1, bash 3.2.57(1)-release.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/check.yml
actions/checkout v3
actions/setup-java v3
actions/cache v3
github/codeql-action v2
actions/upload-artifact v3
.github/workflows/pr.yml
actions/checkout v3
actions/cache v3
actions/setup-java v3
actions/upload-artifact v3
.github/workflows/release.yml
actions/checkout v3
actions/cache v3
actions/setup-java v3
actions/upload-release-asset v1
actions/checkout v3
actions/cache v3
actions/setup-java v3
settings.gradle.kts
de.fayard.refreshVersions 0.51.0
com.gradle.enterprise 3.12.3
build.gradle.kts
build-conventions/settings.gradle.kts
de.fayard.refreshVersions 0.51.0
com.gradle.enterprise 3.12.3
build-conventions/build.gradle.kts
build-conventions/src/main/kotlin/convention.common.gradle.kts
build-conventions/src/main/kotlin/convention.detekt.gradle.kts
build-conventions/src/main/kotlin/convention.git-hooks.gradle.kts
build-conventions/src/main/kotlin/convention.kjvm-app.gradle.kts
build-conventions/src/main/kotlin/convention.local-properties.gradle.kts
build-conventions/src/main/kotlin/dependency-analysis.gradle.kts
cli/build.gradle.kts
io.insert-koin:koin-core 3.3.2
io.insert-koin:koin-logger-slf4j 3.3.0
io.insert-koin:koin-annotations 1.1.0
io.insert-koin:koin-ksp-compiler 1.1.0
io.insert-koin:koin-test-junit5 3.3.2
gradle/wrapper/gradle-wrapper.properties
gradle 8.0-rc-2
I am trying to replace kscript
with ktx
here https://github.com/py2many/py2many/blob/main/tests/test_cli.py#L59
To do that, ktx
needs to be able to run files like https://github.com/py2many/py2many/blob/main/tests/expected/coverage.kt , and https://github.com/py2many/py2many/blob/main/tests/expected/sys_argv.kt , and capture their stdout .
What happens is ktx emits on stdout Kotlin compilation warnings:
WARNING: Condition '1 != null' is always 'true'
WARNING: Variable '_escape_quotes' is never used
WARNING: The expression is unused
WARNING: Variable '_c1' is never used
WARNING: Variable '_c2' is never used
WARNING: Parameter 'argv' is never used
They should be on stderr, or just hidden unless explicitly requested.
And I do not get any of the expected output.
Implement support for running executable jars from mavenCentral. To do so, generate a kts that adds a jar as dependency and invokes its main method.
I wasnt able to find ktx on https://mvnrepository.com/search
I installed my script with
> ktx install https://raw.githubusercontent.com/krzema12/PersonalConfigs/master/scripts/removeLocalMergedBranches.main.kts --alias=remove-merged-branches
but I guess ktx just fetches it once and doesn't check for changes, right? I thought ktx can be made aware of versions somehow. For Maven packages it will be much easier, and for scripts, I can think of several approaches:
I'd then see a feature of updating all/chosen packages/scripts, perhaps also doing it automatically or perhaps only checking for updates.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.