From f12c6b25d35181e0e971af20f427e5c32b28ebd0 Mon Sep 17 00:00:00 2001 From: ManApart Date: Fri, 3 Nov 2023 07:45:31 -0400 Subject: [PATCH] refresh disabled --- manual.md | 4 ++-- src/main/kotlin/commands/Profile.kt | 1 + src/main/kotlin/commands/Refresh.kt | 26 ++++++++++---------------- src/main/kotlin/commands/Validate.kt | 24 ++++++++++++++---------- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/manual.md b/manual.md index 176f2fb..08ab1dd 100644 --- a/manual.md +++ b/manual.md @@ -21,14 +21,14 @@ purge |Purge all sym links | |purge - delete all symlinks and rename override fi mod |Update a mod | |mod id 123 - Update mod's id
mod file ~/Downloads/sleepy-time.zip - Delete mod's stage folder and restage from zip
mod name - renames a mod without changing file paths
rename profile |Create and use local mod lists | |profile list
profile save - create a new profile
profile save - save to an existing profile
profile view
profile load rename |Rename a mod |mv |mod id 123 - Update mod's id
mod file ~/Downloads/sleepy-time.zip - Delete mod's stage folder and restage from zip
mod name - renames a mod without changing file paths
rename -refresh |Refresh mods by id | |refresh
refresh 1 2 4
refresh 1-3
refresh all - For all mods with ids, attempt to redownload (or grab the file from the downloads folder if it exists) and restage.
refresh empty - Refresh any files without staged data
refresh staged - Refresh only files that are staged
refresh enabled - Refresh only files that are enabled
If you're looking to upgrade to a new version, see update and upgrade +refresh |Refresh mods by id | |refresh
refresh 1 2 4
refresh 1-3
refresh all - For all mods with ids, attempt to redownload (or grab the file from the downloads folder if it exists) and restage.
refresh empty - Refresh any files without staged data
refresh staged - Refresh only files that are staged
refresh enabled - Refresh only files that are enabled
refresh disabled - Refresh only files that are NOT enabled
If you're looking to upgrade to a new version, see update and upgrade update |Check for newer versions | |update - fetches latest metadata for mods, including new versions and endorsement data
update
update 1 2 4
update 1-3
Useful for checking for updates existing mods. To check add new mods, see fetch or add.
To download updates, see upgrade upgrade |Upgrade to newer versions | |upgrade
upgrade 1 2 4
upgrade 1-3
upgrade all - For all mods with newer versions, attempt to stage the latest version.
If you want to check for new versions, see update
If you're looking to just redownload or restage a file at the current version, see refresh remove |Delete a mod |rm |remove
rm search |Search Mods |grep, awk |Search for mods and list them once
To apply a filter to future lists, see filter
search - search the given text (name or category)
search 123 - show matching ids
search enabled - show only enabled mods
search disabled
search staged
search unstaged
search missing - show missing ids filter |Apply a filter to Mods | |filter mods that contain the given text (name or category)
Changes persist across future ls until filter clear or filter all is called
To do a one time search, see search
filter -
filter 123 - show matching ids
filter enabled - show only enabled mods
filter disabled
filter staged
filter unstaged
filter missing - show missing ids sort |Sort Mods | |sort the list in various ways. Add reverse to invert the sort
sort name
sort id
sort enabled
sort category
sort order
sort staged -validate |List issues with mods | |validate
validate
validate 1 2 4
validate 1-3
validate staged
validate enabled +validate |List issues with mods | |validate
validate
validate 1 2 4
validate 1-3
validate staged
validate enabled
validate disabled start |Launch Starfield |game |start - run the steam game exit |Exit Program | |Exit the process \ No newline at end of file diff --git a/src/main/kotlin/commands/Profile.kt b/src/main/kotlin/commands/Profile.kt index acf29ef..de286a3 100644 --- a/src/main/kotlin/commands/Profile.kt +++ b/src/main/kotlin/commands/Profile.kt @@ -64,6 +64,7 @@ private fun loadProfile(i: Int) { val enabled = profile.ids.contains(mod.id) || profile.filePaths.contains(mod.filePath) enableMod(enabled, modIndex) } + save() println("Loaded ${profile.name}") } diff --git a/src/main/kotlin/commands/Refresh.kt b/src/main/kotlin/commands/Refresh.kt index 20946d7..959adf0 100644 --- a/src/main/kotlin/commands/Refresh.kt +++ b/src/main/kotlin/commands/Refresh.kt @@ -14,27 +14,17 @@ fun refreshHelp() = """ refresh empty - Refresh any files without staged data refresh staged - Refresh only files that are staged refresh enabled - Refresh only files that are enabled + refresh disabled - Refresh only files that are NOT enabled If you're looking to upgrade to a new version, see update and upgrade """.trimIndent() fun refresh(args: List) { when { args.isEmpty() -> println(refreshHelp()) - args.first() == "empty" -> { - toolData.mods - .filter { !File(it.filePath).exists() } - .refreshMods() - } - args.first() == "staged" -> { - toolData.mods - .filter { File(it.filePath).exists() } - .refreshMods() - } - args.first() == "enabled" -> { - toolData.mods - .filter { it.enabled } - .refreshMods() - } + args.first() == "empty" -> refresh { !File(it.filePath).exists() } + args.first() == "staged" -> refresh { File(it.filePath).exists() } + args.first() == "enabled" -> refresh { it.enabled } + args.first() == "disabled" -> refresh { !it.enabled } else -> { args.getIndicesOrRange(toolData.mods.size) .mapNotNull { toolData.byIndex(it) } @@ -43,8 +33,12 @@ fun refresh(args: List) { } } +private fun refresh(filter: (Mod) -> Boolean) { + toolData.mods.filter(filter).refreshMods() +} + private fun List.refreshMods() { - also { println("Refreshing ${it.size} mods") } + also { println("Refreshing ${it.size} mods") } .forEach { refreshMod(it) } println("Done Refreshing") } \ No newline at end of file diff --git a/src/main/kotlin/commands/Validate.kt b/src/main/kotlin/commands/Validate.kt index 74ee027..1f3f1ca 100644 --- a/src/main/kotlin/commands/Validate.kt +++ b/src/main/kotlin/commands/Validate.kt @@ -12,23 +12,27 @@ fun validateHelp() = """ validate 1-3 validate staged validate enabled + validate disabled """.trimIndent() fun validateMods(args: List) { - with(toolData.mods) { - when { - args.isEmpty() -> validate() - args.first() == "staged" -> filter { File(it.filePath).exists() }.validate() - args.first() == "enabled" -> filter { it.enabled }.validate() - else -> { - args.getIndicesOrRange(size) - .mapNotNull { toolData.byIndex(it) } - .validate() - } + when { + args.isEmpty() -> validate() + args.first() == "staged" -> validate { File(it.filePath).exists() } + args.first() == "enabled" -> validate { it.enabled } + args.first() == "disabled" -> validate { it.enabled } + else -> { + args.getIndicesOrRange(toolData.mods.size) + .mapNotNull { toolData.byIndex(it) } + .validate() } } } +private fun validate(filter: (Mod) -> Boolean = {true}) { + toolData.mods.filter(filter).validate() +} + private fun List.validate() { println("Validating $size mods") val errorMap = mutableMapOf>>()