factorio mod deploy tweaks (better confirmation and link to the page)

This commit is contained in:
Adam 2022-06-20 23:56:58 +02:00
parent d2768c3c9e
commit 4cdbaa9daf

View file

@ -71,7 +71,7 @@ class FactorioModPortalPublishClient(
"",
)
val confirmed = enteredVersion.trim() == modVersion.trim()
val confirmed = enteredVersion.trim().equals(modVersion.trim(), ignoreCase = true)
if (confirmed) {
upload(initUploadResponse)
@ -98,7 +98,7 @@ class FactorioModPortalPublishClient(
require(response.status.isSuccess()) { "init upload request failed" }
return when (initUploadResponse) {
is Failure -> error(initUploadResponse)
is Failure -> error(initUploadResponse)
is InitUploadResponse.Success -> initUploadResponse
}
}
@ -130,18 +130,4 @@ class FactorioModPortalPublishClient(
}
println("Mod uploaded successfully! ${modPortalBaseURl.removeSuffix("/")}/$modName")
}
companion object {
/**
* @see org.jetbrains.kotlin.cli.common.toBooleanLenient
*/
private fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()?.trim()) {
null -> false
in listOf("yes", "true", "on", "y") -> true
in listOf("", "no", "false", "off", "n") -> false
else -> null
}
}
}