Skip to content

Commit

Permalink
auto deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ManApart committed Jan 13, 2024
1 parent c10980e commit 3fc2c0a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data class Config(
var apiKey: String? = null,
var useMyDocs: Boolean = false,
var verbose: Boolean = false,
var autoDeploy: Boolean = true,
var categories: Map<Int, String> = mapOf(),
) {
fun usedGamePath(modGamePath: String) = if (useMyDocs && modGamePath.startsWith("Data", true)) iniPath else gamePath
Expand Down
9 changes: 9 additions & 0 deletions src/main/kotlin/commands/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ val configDescription = """
appdata-path should be the path to the folder under your appdata that will contain Plugins.txt. Needed for updating mod load order
ini-path should be the path to the folder under your documents that contains StarfieldCustom.ini. It's optionally used to deploy to your my docs folder instead of the game path
verbose gives additional output (for debugging) if set to true
autodeploy automatically runs deploy when enabling or disabling mods. Defaults to true
use-my-docs optionally allows deploying mod files under Data to my documents instead of the game folder. (Defaults to false)
categories is used to download category names from nexus
If your paths have spaces, make sure to quote them
Expand All @@ -23,6 +24,7 @@ val configUsage = """
config ini-path <path-to-folder>
config api-key <key-from-nexus>
config verbose <true/false>
config autodeploy <true/false>
config use-my-docs <true/false>
config categories
""".trimIndent()
Expand Down Expand Up @@ -75,6 +77,13 @@ fun config(args: List<String>) {
save()
}

args.first() == "autodeploy" -> {
val autoDeploy = args.getOrNull(1) == "true"
toolConfig.autoDeploy = autoDeploy
println("Updated autodeploy to ${toolConfig.autoDeploy}")
save()
}

args.first() == "use-my-docs" -> {
val useMyDocs = args.getOrNull(1) == "true"
toolConfig.useMyDocs = useMyDocs
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/commands/EnableMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import StageChange
import cyan
import detectStagingChanges
import save
import toolConfig
import toolData
import yellow
import java.io.File
Expand Down Expand Up @@ -37,6 +38,7 @@ private fun enableMod(enable: Boolean = true, args: List<String>) {
args.size == 1 && args.first() == "all" -> enableRange(enable, listOf("0-${toolData.mods.size - 1}"))
else -> enableList(enable, args)
}
if (args.isNotEmpty() && toolConfig.autoDeploy) deploy(listOf())
}

private fun enableList(enable: Boolean, args: List<String>) {
Expand Down

0 comments on commit 3fc2c0a

Please sign in to comment.