Skip to content

Commit

Permalink
allow skipping the prompt to install a product via new argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rfvgyhn committed Jan 7, 2025
1 parent e634ada commit 7ca6727
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/MinEdLauncher/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/MinEdLauncher/Settings.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let defaults =
QuitMode = WaitForInput
WatchForCrashes = true
ProductWhitelist = OrdinalIgnoreCaseSet.empty
SkipInstallPrompt = false
ForceLocal = false
CompatTool = None
CbLauncherDir = "."
Expand Down Expand Up @@ -151,6 +152,7 @@ let parseArgs defaults (findCbLaunchDir: Platform -> Result<string,string>) (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
Expand Down
1 change: 1 addition & 0 deletions src/MinEdLauncher/Types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type LauncherSettings =
QuitMode: QuitMode
WatchForCrashes: WatchForCrashes
ProductWhitelist: OrdinalIgnoreCaseSet
SkipInstallPrompt: bool
ForceLocal: ForceLocal
CompatTool: CompatTool option
CbLauncherDir: string
Expand Down
4 changes: 4 additions & 0 deletions tests/Settings.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 7ca6727

Please sign in to comment.