Update clikt

This allows us to remove the cli module containing our clikt extensions,
which are now supported by upstream.

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 346cecf885
commit 88bed9923b
  1. 2
      buildSrc/src/main/java/Versions.kt
  2. 24
      cli/build.gradle.kts
  3. 41
      cli/src/main/java/dev/openrs2/cli/OptionExtensions.kt
  4. 2
      compress-cli/build.gradle.kts
  5. 8
      compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt
  6. 8
      compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt
  7. 8
      compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt
  8. 8
      compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt
  9. 8
      compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt
  10. 8
      compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt
  11. 2
      crc32/build.gradle.kts
  12. 4
      crc32/src/main/java/dev/openrs2/crc32/Crc32Command.kt
  13. 1
      settings.gradle.kts

@ -1,7 +1,7 @@
object Versions { object Versions {
const val asm = "8.0.1" const val asm = "8.0.1"
const val bouncyCastle = "1.65" const val bouncyCastle = "1.65"
const val clikt = "2.6.0" const val clikt = "2.7.0"
const val commonsCompress = "1.20" const val commonsCompress = "1.20"
const val dependencyLicenseReport = "1.14" const val dependencyLicenseReport = "1.14"
const val dokka = "0.10.1" const val dokka = "0.10.1"

@ -1,24 +0,0 @@
plugins {
`maven-publish`
kotlin("jvm")
}
dependencies {
api("com.github.ajalt:clikt:${Versions.clikt}")
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
pom {
packaging = "jar"
name.set("OpenRS2 CLI")
description.set(
"""
Clikt extensions.
""".trimIndent()
)
}
}
}

@ -1,41 +0,0 @@
package dev.openrs2.cli
import com.github.ajalt.clikt.parameters.options.NullableOption
import com.github.ajalt.clikt.parameters.options.OptionWithValues
import com.github.ajalt.clikt.parameters.options.RawOption
import com.github.ajalt.clikt.parameters.options.convert
import com.github.ajalt.clikt.parameters.options.default
import java.io.InputStream
import java.io.OutputStream
import java.nio.file.Files
import java.nio.file.Paths
fun RawOption.inputStream(): NullableOption<InputStream, InputStream> {
return convert("FILE") {
return@convert if (it == "-") {
System.`in`
} else {
Files.newInputStream(Paths.get(it))
}
}
}
fun NullableOption<InputStream, InputStream>.defaultStdin(): OptionWithValues<InputStream, InputStream, InputStream> {
return default(System.`in`, "-")
}
fun RawOption.outputStream(): NullableOption<OutputStream, OutputStream> {
return convert("FILE") {
return@convert if (it == "-") {
System.out
} else {
Files.newOutputStream(Paths.get(it))
}
}
}
fun NullableOption<OutputStream, OutputStream>.defaultStdout(): OptionWithValues<OutputStream, OutputStream,
OutputStream> {
return default(System.out, "-")
}

@ -9,7 +9,7 @@ application {
} }
dependencies { dependencies {
api(project(":cli")) api("com.github.ajalt:clikt:${Versions.clikt}")
implementation(project(":compress")) implementation(project(":compress"))
} }

@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.bzip2
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.defaultStdin
import dev.openrs2.cli.defaultStdout import com.github.ajalt.clikt.parameters.types.defaultStdout
import dev.openrs2.cli.inputStream import com.github.ajalt.clikt.parameters.types.inputStream
import dev.openrs2.cli.outputStream import com.github.ajalt.clikt.parameters.types.outputStream
import dev.openrs2.compress.bzip2.Bzip2 import dev.openrs2.compress.bzip2.Bzip2
class Bunzip2Command : CliktCommand(name = "bunzip2") { class Bunzip2Command : CliktCommand(name = "bunzip2") {

@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.bzip2
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.defaultStdin
import dev.openrs2.cli.defaultStdout import com.github.ajalt.clikt.parameters.types.defaultStdout
import dev.openrs2.cli.inputStream import com.github.ajalt.clikt.parameters.types.inputStream
import dev.openrs2.cli.outputStream import com.github.ajalt.clikt.parameters.types.outputStream
import dev.openrs2.compress.bzip2.Bzip2 import dev.openrs2.compress.bzip2.Bzip2
class Bzip2Command : CliktCommand(name = "bzip2") { class Bzip2Command : CliktCommand(name = "bzip2") {

@ -4,11 +4,11 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.validate import com.github.ajalt.clikt.parameters.options.validate
import com.github.ajalt.clikt.parameters.types.defaultStdin
import com.github.ajalt.clikt.parameters.types.defaultStdout
import com.github.ajalt.clikt.parameters.types.inputStream
import com.github.ajalt.clikt.parameters.types.int import com.github.ajalt.clikt.parameters.types.int
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.outputStream
import dev.openrs2.cli.defaultStdout
import dev.openrs2.cli.inputStream
import dev.openrs2.cli.outputStream
import java.util.zip.Deflater import java.util.zip.Deflater
import java.util.zip.DeflaterOutputStream import java.util.zip.DeflaterOutputStream

@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.deflate
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.defaultStdin
import dev.openrs2.cli.defaultStdout import com.github.ajalt.clikt.parameters.types.defaultStdout
import dev.openrs2.cli.inputStream import com.github.ajalt.clikt.parameters.types.inputStream
import dev.openrs2.cli.outputStream import com.github.ajalt.clikt.parameters.types.outputStream
import java.util.zip.Inflater import java.util.zip.Inflater
import java.util.zip.InflaterInputStream import java.util.zip.InflaterInputStream

@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.gzip
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.defaultStdin
import dev.openrs2.cli.defaultStdout import com.github.ajalt.clikt.parameters.types.defaultStdout
import dev.openrs2.cli.inputStream import com.github.ajalt.clikt.parameters.types.inputStream
import dev.openrs2.cli.outputStream import com.github.ajalt.clikt.parameters.types.outputStream
import dev.openrs2.compress.gzip.Gzip import dev.openrs2.compress.gzip.Gzip
class GunzipCommand : CliktCommand(name = "gunzip") { class GunzipCommand : CliktCommand(name = "gunzip") {

@ -4,11 +4,11 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.validate import com.github.ajalt.clikt.parameters.options.validate
import com.github.ajalt.clikt.parameters.types.defaultStdin
import com.github.ajalt.clikt.parameters.types.defaultStdout
import com.github.ajalt.clikt.parameters.types.inputStream
import com.github.ajalt.clikt.parameters.types.int import com.github.ajalt.clikt.parameters.types.int
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.outputStream
import dev.openrs2.cli.defaultStdout
import dev.openrs2.cli.inputStream
import dev.openrs2.cli.outputStream
import dev.openrs2.compress.gzip.Gzip import dev.openrs2.compress.gzip.Gzip
import java.util.zip.Deflater import java.util.zip.Deflater

@ -9,7 +9,7 @@ application {
} }
dependencies { dependencies {
api(project(":cli")) api("com.github.ajalt:clikt:${Versions.clikt}")
} }
publishing { publishing {

@ -2,8 +2,8 @@ package dev.openrs2.crc32
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.option
import dev.openrs2.cli.defaultStdin import com.github.ajalt.clikt.parameters.types.defaultStdin
import dev.openrs2.cli.inputStream import com.github.ajalt.clikt.parameters.types.inputStream
import java.util.zip.CRC32 import java.util.zip.CRC32
fun main(args: Array<String>) = Crc32Command().main(args) fun main(args: Array<String>) = Crc32Command().main(args)

@ -4,7 +4,6 @@ include(
"all", "all",
"asm", "asm",
"bundler", "bundler",
"cli",
"compress", "compress",
"compress-cli", "compress-cli",
"conf", "conf",

Loading…
Cancel
Save