Skip to content

Commit

Permalink
Merge pull request #2665 from PaulWoitaschek/script_fix
Browse files Browse the repository at this point in the history
Adjust to the latest clikt changes
  • Loading branch information
PaulWoitaschek authored Dec 28, 2024
2 parents c5623a1 + 801a542 commit 0be5cba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions scripts/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.kotlin.jvm)
id("voice.ktlint")
application
}

Expand All @@ -10,3 +11,9 @@ application {
dependencies {
implementation(libs.clikt)
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
4 changes: 3 additions & 1 deletion scripts/src/main/kotlin/voice/scripts/NewFeatureModule.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package voice.scripts

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.arguments.validate
import java.io.File

class NewFeatureModule : CliktCommand(help = "Creates a new feature module") {
class NewFeatureModule : CliktCommand() {

private val name: String by argument("The new module name, i.e. :unicorn:wings")
.validate { name ->
Expand All @@ -18,6 +19,7 @@ class NewFeatureModule : CliktCommand(help = "Creates a new feature module") {
name.removePrefix(":").split(":")
}

override fun help(context: Context): String = "Creates a new feature module"
override fun run() {
val moduleRoot = File(components.joinToString(separator = "/"))

Expand Down
5 changes: 4 additions & 1 deletion scripts/src/main/kotlin/voice/scripts/PopulateTestFiles.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package voice.scripts

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.Context
import java.io.File

class PopulateTestFiles : CliktCommand(help = "Populates test files using adb") {
class PopulateTestFiles : CliktCommand() {

private val testFilesRoot = File("build/testfiles/")

Expand All @@ -17,6 +18,8 @@ class PopulateTestFiles : CliktCommand(help = "Populates test files using adb")
pushToAdb()
}

override fun help(context: Context): String = "Populates test files using adb"

private fun pushToAdb() {
println("Pushing to adb")
runCommand("adb", "shell", "rm", "-rf", "/sdcard/testfiles")
Expand Down
1 change: 1 addition & 0 deletions scripts/src/main/kotlin/voice/scripts/Script.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package voice.scripts

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.main
import com.github.ajalt.clikt.core.subcommands

class Script : CliktCommand() {
Expand Down

0 comments on commit 0be5cba

Please sign in to comment.