From 7ca67277c7c4e81935d7cf2092ccb10e025f94d7 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 7 Jan 2025 15:48:39 -0700 Subject: [PATCH] allow skipping the prompt to install a product via new argument --- CHANGELOG.md | 1 + README.md | 1 + src/MinEdLauncher/App.fs | 4 +++- src/MinEdLauncher/Settings.fs | 2 ++ src/MinEdLauncher/Types.fs | 1 + tests/Settings.fs | 4 ++++ 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9db548..ba15964 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ "keepOpen": true }] ``` +- Allow skipping the prompt to install a product when `/autorun` isn't specified with the new flag `/skipInstallPrompt`. ### Enhancements - Read additional processes' STDOUT/ERR asynchronously. This should allow [EDOMH] to launch without locking up. diff --git a/README.md b/README.md index 68074a8..677d8b3 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ The following arguments are in addition to the above: | /frontier profile-name | Use this argument to login with a Frontier Store account. `profile-name` can be any name you want. Keep it to letters, numbers, dashes and underscores. See more details in the [multi-account] section | | /restart delay | Restart the game after it has closed with _delay_ being the number of seconds given to cancel the restart (i.e `/restart 3`) | | /dryrun | Prints output without launching any processes | +| /skipInstallPrompt | Skips the prompt to install uninstalled products when `/autorun` is not specified | ##### Epic accounts and the /restart feature The restart feature requires either [Legendary] or [Heroic] to work with Epic accounts. diff --git a/src/MinEdLauncher/App.fs b/src/MinEdLauncher/App.fs index 861f8b3..fa77824 100644 --- a/src/MinEdLauncher/App.fs +++ b/src/MinEdLauncher/App.fs @@ -442,8 +442,10 @@ let run settings launcherVersion cancellationToken = taskResult { |> List.toArray if settings.AutoRun then Product.selectProduct settings.ProductWhitelist missing |> Option.map(fun p -> [| p |]) |> Option.defaultWith(fun () -> [||]) - else + else if not settings.SkipInstallPrompt then missing |> Console.promptForProductsToUpdate "install" + else + [||] let productsRequiringUpdate = products |> Product.filterByUpdateRequired diff --git a/src/MinEdLauncher/Settings.fs b/src/MinEdLauncher/Settings.fs index f24ce24..05c53b2 100644 --- a/src/MinEdLauncher/Settings.fs +++ b/src/MinEdLauncher/Settings.fs @@ -15,6 +15,7 @@ let defaults = QuitMode = WaitForInput WatchForCrashes = true ProductWhitelist = OrdinalIgnoreCaseSet.empty + SkipInstallPrompt = false ForceLocal = false CompatTool = None CbLauncherDir = "." @@ -151,6 +152,7 @@ let parseArgs defaults (findCbLaunchDir: Platform -> Result) (arg | "/autoquit", _ -> { s with QuitMode = Immediate } | "/forcelocal", _ -> { s with ForceLocal = true } | "/dryrun", _ -> { s with DryRun = true } + | "/skipinstallprompt", _ -> { s with SkipInstallPrompt = true } | arg, _ when arg.StartsWith('/') && arg.Length > 1 -> { s with ProductWhitelist = s.ProductWhitelist.Add (arg.TrimStart('/')) } | _ -> s) defaults diff --git a/src/MinEdLauncher/Types.fs b/src/MinEdLauncher/Types.fs index aab5b23..972c3f5 100644 --- a/src/MinEdLauncher/Types.fs +++ b/src/MinEdLauncher/Types.fs @@ -111,6 +111,7 @@ type LauncherSettings = QuitMode: QuitMode WatchForCrashes: WatchForCrashes ProductWhitelist: OrdinalIgnoreCaseSet + SkipInstallPrompt: bool ForceLocal: ForceLocal CompatTool: CompatTool option CbLauncherDir: string diff --git a/tests/Settings.fs b/tests/Settings.fs index a8d79b7..0a4fae3 100644 --- a/tests/Settings.fs +++ b/tests/Settings.fs @@ -79,6 +79,10 @@ let tests = let settings = parse [| "/novr" |] Expect.equal settings.DisplayMode Pancake "" } + test "Matches /skipInstallPrompt" { + let settings = parse [| "/skipInstallPrompt" |] + Expect.equal settings.SkipInstallPrompt true "" + } test "Matches /dryrun" { let settings = parse [| "/dryrun" |] Expect.isTrue settings.DryRun ""