diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt index a69d561184..b72c277a4d 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt @@ -10,7 +10,7 @@ import dev.openrs2.compress.bzip2.Bzip2 public class Bunzip2Command : CliktCommand(name = "bunzip2") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() override fun run() { Bzip2.createHeaderlessInputStream(input).use { input -> diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt index 0b0f9355b0..00f8cbb947 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt @@ -10,7 +10,7 @@ import dev.openrs2.compress.bzip2.Bzip2 public class Bzip2Command : CliktCommand(name = "bzip2") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() override fun run() { input.use { input -> diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt index bb3f7cd5f9..78199f0af7 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt @@ -14,7 +14,7 @@ import java.util.zip.DeflaterOutputStream public class DeflateCommand : CliktCommand(name = "deflate") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() private val level by option().int().default(Deflater.BEST_COMPRESSION).validate { require(it >= Deflater.NO_COMPRESSION && it <= Deflater.BEST_COMPRESSION) { "--level must be between ${Deflater.NO_COMPRESSION} and ${Deflater.BEST_COMPRESSION} inclusive" diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt index 433f57beb6..e429caae69 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt @@ -11,7 +11,7 @@ import java.util.zip.InflaterInputStream public class InflateCommand : CliktCommand(name = "inflate") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() override fun run() { InflaterInputStream(input, Inflater(true)).use { input -> diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt index edd67178ed..bca04becb7 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt @@ -10,7 +10,7 @@ import dev.openrs2.compress.gzip.Gzip public class GunzipCommand : CliktCommand(name = "gunzip") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() override fun run() { Gzip.createHeaderlessInputStream(input).use { input -> diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt index bbd653d2bf..becca157fc 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt @@ -14,7 +14,7 @@ import java.util.zip.Deflater public class GzipCommand : CliktCommand(name = "gzip") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() private val level by option().int().default(Deflater.BEST_COMPRESSION).validate { require(it >= Deflater.NO_COMPRESSION && it <= Deflater.BEST_COMPRESSION) { "--level must be between ${Deflater.NO_COMPRESSION} and ${Deflater.BEST_COMPRESSION} inclusive" diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/LzmaCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/LzmaCommand.kt index aad1b45c09..42a06a4284 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/LzmaCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/LzmaCommand.kt @@ -14,7 +14,7 @@ import org.tukaani.xz.LZMA2Options public class LzmaCommand : CliktCommand(name = "lzma") { private val input by option().inputStream().defaultStdin() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() private val level by option().int().default(LZMA2Options.PRESET_DEFAULT).validate { require(it >= LZMA2Options.PRESET_MIN && it <= LZMA2Options.PRESET_MAX) { "--level must be between ${LZMA2Options.PRESET_MIN} and ${LZMA2Options.PRESET_MAX} inclusive" diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/UnlzmaCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/UnlzmaCommand.kt index 2fb8f1725e..ab6a117379 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/UnlzmaCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/lzma/UnlzmaCommand.kt @@ -13,7 +13,7 @@ import dev.openrs2.compress.lzma.Lzma public class UnlzmaCommand : CliktCommand(name = "unlzma") { private val input by option().inputStream().defaultStdin() private val length by option().long().required() - private val output by option().outputStream().defaultStdout() + private val output by option().outputStream(truncateExisting = true).defaultStdout() override fun run() { Lzma.createHeaderlessInputStream(input, length).use { input ->