Am I dumb or where is the ktlint.jar for windows?
# ktlint
d
Am I dumb or where is the ktlint.jar for windows?
j
AFAIK, Ktlint doesn't have native bindings
So it should just work on any JVM
d
but how to use it on Windows, I cannot just write ktlint on the command line
or if I try to run it on Android Studio I get .git/hooks/pre-commit: line 5: ktlint: command not found (I'm lost 😄 )
e
if you're downloading from the assets on the tagged releases, the
ktlint
script is just a simple shell wrapper prepended to a JAR. you can run it with
java -jar
or replace the prefix with your own batch script launcher.
or if you have git pre-commit hooks that run, that presumes you already have a shell environment, so possibly the ktlint shell script will work as long as you put it in path somewhere?
d
now I got it, the confusion comes that the file ktlint does not have any extension, oooohh boy 😄 I would recommend to add the .jar extension then it would be super clear
e
it does not have an extension because it is shell script first
it happens to be a JAR second (and that's how the script works, by launching itself with java)
d
I don't know if Windows Users would know this, I never in my life run a file without .jar extension with the java -jar command, jm2c, thanks anyways for the fast help!
p
I had some troubles finding it, but it is documented https://pinterest.github.io/ktlint/install/cli/#microsoft-windows-users
103 Views