From ca809f0948379e3a825f24d7a49aba8b6b8767d1 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 3 Sep 2023 22:40:01 +0200 Subject: [PATCH 1/2] fix: Create options if it does not exist when updating them Previously, the file could not be read to be updated. If the file does not exist, simply serialize the options to the file. --- .../kotlin/app/revanced/cli/command/OptionsCommand.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/OptionsCommand.kt b/src/main/kotlin/app/revanced/cli/command/OptionsCommand.kt index 91f38f2..863f8d7 100644 --- a/src/main/kotlin/app/revanced/cli/command/OptionsCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/OptionsCommand.kt @@ -23,7 +23,7 @@ internal object OptionsCommand : Runnable { @CommandLine.Option( names = ["-p", "--path"], description = ["Path to patch options JSON file"], showDefaultValue = ALWAYS ) - private var path: File = File("options.json") + private var filePath: File = File("options.json") @CommandLine.Option( names = ["-o", "--overwrite"], description = ["Overwrite existing options file"], showDefaultValue = ALWAYS @@ -37,10 +37,10 @@ internal object OptionsCommand : Runnable { ) private var update: Boolean = false - override fun run() = if (!path.exists() || overwrite) with(PatchBundleLoader.Jar(*patchBundles)) { - if (update) setOptions(path) + override fun run() = if (!filePath.exists() || overwrite) with(PatchBundleLoader.Jar(*patchBundles)) { + if (update && filePath.exists()) setOptions(filePath) - Options.serialize(this, prettyPrint = true).let(path::writeText) + Options.serialize(this, prettyPrint = true).let(filePath::writeText) } else logger.severe("Options file already exists, use --override to override it") } \ No newline at end of file From 0304988733cdafa2e78f55cb07d16e41b858deed Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 3 Sep 2023 20:42:58 +0000 Subject: [PATCH 2/2] chore(release): 3.1.1-dev.1 [skip ci] ## [3.1.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v3.1.0...v3.1.1-dev.1) (2023-09-03) ### Bug Fixes * Create options if it does not exist when updating them ([ca809f0](https://github.com/ReVanced/revanced-cli/commit/ca809f0948379e3a825f24d7a49aba8b6b8767d1)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60f0f24..8f008fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [3.1.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v3.1.0...v3.1.1-dev.1) (2023-09-03) + + +### Bug Fixes + +* Create options if it does not exist when updating them ([ca809f0](https://github.com/ReVanced/revanced-cli/commit/ca809f0948379e3a825f24d7a49aba8b6b8767d1)) + # [3.1.0](https://github.com/ReVanced/revanced-cli/compare/v3.0.1...v3.1.0) (2023-08-31) diff --git a/gradle.properties b/gradle.properties index 3060605..5293e27 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 3.1.0 +version = 3.1.1-dev.1