mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-11-01 11:14:31 +01:00
Add option to automatically close after a user-supplied amount of time (#42)
* Add option to automatically close after a user-specific amount of time Add the -t/--timeout command line option to specific a number of seconds to wait before automatically closing if there is no update or user-interactivity required. * Also use timeout setting when prompting about optional mods after/during an update Additionally, clears the TODO comment. * Change default timeout to 10 seconds
This commit is contained in:
@@ -103,10 +103,13 @@ class Main(args: Array<String>) {
|
||||
val manifestFile = ui.wrap("Invalid manifest file path") {
|
||||
packFolder / (cmd.getOptionValue("meta-file") ?: "packwiz.json")
|
||||
}
|
||||
val timeout = ui.wrap("Invalid timeout value") {
|
||||
cmd.getOptionValue("timeout")?.toLong() ?: 10
|
||||
}
|
||||
|
||||
// Start update process!
|
||||
try {
|
||||
UpdateManager(UpdateManager.Options(packFile, manifestFile, packFolder, multimcFolder, side), ui)
|
||||
UpdateManager(UpdateManager.Options(packFile, manifestFile, packFolder, multimcFolder, side, timeout), ui)
|
||||
} catch (e: Exception) {
|
||||
ui.showErrorAndExit("Update process failed", e)
|
||||
}
|
||||
@@ -123,6 +126,7 @@ class Main(args: Array<String>) {
|
||||
options.addOption(null, "pack-folder", true, "Folder to install the pack to (defaults to the JAR directory)")
|
||||
options.addOption(null, "multimc-folder", true, "The MultiMC pack folder (defaults to the parent of the pack directory)")
|
||||
options.addOption(null, "meta-file", true, "JSON file to store pack metadata, relative to the pack folder (defaults to packwiz.json)")
|
||||
options.addOption("t", "timeout", true, "Seconds to wait before automatically launching when asking about optional mods (defaults to 10)")
|
||||
}
|
||||
|
||||
// TODO: link these somehow so they're only defined once?
|
||||
|
||||
Reference in New Issue
Block a user