@@ -20,7 +20,10 @@ $Script:InstallLocation = $null
20
20
$Script :PackageURL = $null
21
21
$Script :ModuleVersion = $null
22
22
$Script :NewPSRLInstalled = $false
23
- $Script :PSRLDependencyMap = @ { ' 1.0.4-preview4' = ' 2.4.2-beta2' }
23
+ $Script :PSRLDependencyMap = @ {
24
+ ' 1.0.4-preview4' = ' 2.4.2-beta2'
25
+ ' 1.0.6-preview6' = ' 2.4.3-beta3'
26
+ }
24
27
25
28
function Resolve-Environment {
26
29
if ($PSVersionTable.PSVersion -lt [version ]" 7.4.6" ) {
@@ -211,7 +214,8 @@ function Install-AIShellModule {
211
214
Write-Host " Installing the PowerShell module 'AIShell' $modVersion ..."
212
215
Install-PSResource - Name AIShell - Repository PSGallery - Prerelease - TrustRepository - Version $modVersion - ErrorAction Stop - WarningAction SilentlyContinue
213
216
214
- $psrldep = $Script :PSRLDependencyMap [$modVersion ]
217
+ $psrldep = GetPSRLDependency - modVersion $modVersion
218
+
215
219
if ($psrldep ) {
216
220
$psrlModule = Get-Module - Name PSReadLine
217
221
$psrlVer = $psrldep.Contains (' -' ) ? $psrldep.Split (' -' )[0 ] : $psrldep
@@ -228,6 +232,23 @@ function Install-AIShellModule {
228
232
}
229
233
}
230
234
235
+ function GetPSRLDependency {
236
+ param ([string ] $modVersion )
237
+
238
+ $keys = $Script :PSRLDependencyMap.Keys
239
+ $curVer = [version ]($modVersion.Contains (' -' ) ? $modVersion.Split (' -' )[0 ] : $modVersion )
240
+
241
+ $psrldep = $null
242
+ foreach ($key in $keys ) {
243
+ $ver = $key.Contains (' -' ) ? $key.Split (' -' )[0 ] : $key
244
+ if ($curVer -ge [version ]$ver ) {
245
+ $psrldep = $Script :PSRLDependencyMap [$key ]
246
+ }
247
+ }
248
+
249
+ return $psrldep
250
+ }
251
+
231
252
function Uninstall-AIShellModule {
232
253
if (Get-InstalledPSResource - Name " AIShell" - ErrorAction SilentlyContinue) {
233
254
try {
0 commit comments