<@U3ZLHBTLG> running commands as a extension funct...
# announcements
n
@louiscad running commands as a extension function
👍 2
i am sure there is things that can be improved.. tis worked well for my usecase of long running jobs
l
I think you can remove the try catch block as we're not in java
Works wonder, thank you!
So… it doesn't work wonder for all commands, which is confusing… If I edit a file, then run this, and check git log, nothing changed, no new commit:
Copy code
val newVersion = "3.0.0-alpha02"
println("git commit -am \"Prepare for release $newVersion\"".execute())
n
you have to pass a working directory.. or what is the default one ?
l
It is
File(".")
Note that it works when I run
git tag
, so the quotes are likely confusing the split call
@Nikky I solved my problem thanks to your help and other stuff on the internet, here's what I did: https://github.com/LouisCAD/Splitties/blob/2ec8f895e7fe4046c528d8659a9848ce020eee45/Releasing.kts#L24-L70 Thanks @amanda.hinchman-dominguez for your help too, and maybe this link above may be helpful to you in the future if you run shell/cmd commands from Kotlin
a
I didn't do anything, @Nikky deserves all tne credit, I've also been learning from her and I was just excited to be part of the convo!
@louiscad will definitely peep at your project though!
n
it would probably be easier to just do
arrayOf("git",  "commit", "-am", message).execute(workingDir = File("."))
unless you have to emulate the same splitting behaviour as bash
or cmd
l
It'd have been easier, but I wanted it to work just like bash, and be able to support new commands in the future if needed, and I could do it