Skip to content

Commit 3e5267b

Browse files
Merge pull request #1 from rjmholt/get-latest-psrl
Get the latest PSReadLine module installed
2 parents ce49cd6 + e124fb1 commit 3e5267b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,25 @@ task RestorePsesModules -After Build {
309309

310310
Save-Module @splatParameters
311311
}
312+
313+
# TODO: Replace this with adding a new module to Save when a new PSReadLine release comes out to the Gallery
314+
if (-not (Test-Path $PSScriptRoot/module/PSReadLine))
315+
{
316+
Write-Host "`tInstalling module: PSReadLine"
317+
318+
# Download AppVeyor zip
319+
$jobId = (Invoke-RestMethod https://ci.appveyor.com/api/projects/lzybkr/PSReadLine).build.jobs[0].jobId
320+
Invoke-RestMethod https://ci.appveyor.com/api/buildjobs/$jobId/artifacts/bin%2FRelease%2FPSReadLine.zip -OutFile $PSScriptRoot/module/PSRL
321+
322+
# Position PSReadLine
323+
Expand-Archive $PSScriptRoot/module/PSRL.zip $PSScriptRoot/module/PSRL
324+
Move-Item $PSScriptRoot/module/PSRL/PSReadLine $PSScriptRoot/module
325+
326+
# Clean up
327+
Remove-Item -Force -Recurse $PSScriptRoot/module/PSRL.zip
328+
Remove-Item -Force -Recurse $PSScriptRoot/module/PSRL
329+
}
330+
312331
Write-Host "`n"
313332
}
314333

src/PowerShellEditorServices/Session/PSReadLinePromptContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ internal class PSReadLinePromptContext : IPromptContext {
2929
[System.Diagnostics.DebuggerStepThrough()]
3030
param()
3131
end {
32-
$module = Get-Module -ListAvailable PSReadLine | Select-Object -First 1
33-
if (-not $module -or $module.Version -lt ([version]'2.0.0')) {
32+
$module = Get-Module -ListAvailable PSReadLine | Where-Object Version -ge '2.0.0' | Sort-Object -Descending Version | Select-Object -First 1
33+
if (-not $module) {
3434
return
3535
}
3636

0 commit comments

Comments
 (0)