Skip to content

Commit

Permalink
Use string array for -GamePlatform, -GameEngine, and -Game` to …
Browse files Browse the repository at this point in the history
…allow specifying multiple values
  • Loading branch information
leojonathanoh committed Nov 27, 2023
1 parent 3f20cf8 commit 97a7740
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Generate-GitBranches.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ param(
[switch]$Push
,
# E.g. 'steam'
[string]$GamePlatform
[string[]]$GamePlatform
,
# E.g. 'hlds' or 'srcds'
[string]$GameEngine
[string[]]$GameEngine
,
# E.g. 'cstrike'
[string]$Game
[string[]]$Game
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

# Get games
$games = Get-Content $PSScriptRoot/games.json -Encoding utf8 -Force | ConvertFrom-Json -AsHashtable
if ($GamePlatform) {
$games = $games | ? { $_['game_platform'] -eq $GamePlatform }
$games = $games | ? { $_['game_platform'] -in $GamePlatform }
}
if ($GameEngine) {
$games = $games | ? { $_['game_engine'] -eq $GameEngine }
$games = $games | ? { $_['game_engine'] -in $GameEngine }
}
if ($Game) {
$games = $games | ? { $_['game'] -eq $Game }
$games = $games | ? { $_['game'] -in $Game }
}
if ($games.Count -eq 0) {
throw "No games found"
Expand Down

0 comments on commit 97a7740

Please sign in to comment.