Skip to content

Commit 0f33b8e

Browse files
committed
fixes module name usage
1 parent 9123b8d commit 0f33b8e

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

private/Update-QuickPath.ps1

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,35 @@ function Update-QuickPath {
1515

1616
function Update-QuickPathFromGallery {
1717
try {
18-
if (Get-Module quickpath) {
19-
Remove-Module quickpath -Force -ErrorAction SilentlyContinue
18+
$moduleName = $MyInvocation.MyCommand.Module.Name
19+
if (Get-Module $moduleName) {
20+
Remove-Module $moduleName -Force -ErrorAction SilentlyContinue
2021
}
21-
Update-Module -Name quickpath -Force -ErrorAction Stop
22-
Import-Module quickpath -Force -ErrorAction Stop
23-
Write-Host "quickpath updated from gallery and reloaded." -ForegroundColor Green
22+
Update-Module -Name $moduleName -Force -ErrorAction Stop
23+
Import-Module $moduleName -Force -ErrorAction Stop
24+
Write-Host "$moduleName updated from gallery and reloaded." -ForegroundColor Green
2425
}
2526
catch {
26-
Write-Error "Failed to update 'quickpath' from gallery: $($_.Exception.Message)"
27+
Write-Error "Failed to update '$moduleName' from gallery: $($_.Exception.Message)"
2728
throw
2829
}
2930
}
3031

3132
function Update-QuickPathFromBuild {
3233
try {
34+
$moduleName = $MyInvocation.MyCommand.Module.Name
3335
$quickPathManifest = Join-Path -Path $PSScriptRoot -ChildPath "..\output\quickpath\quickpath.psd1"
3436
if ( -not (Test-Path $quickPathManifest)) {
3537
Write-Warning "Built quickpath module not found at '$quickPathManifest'. Please run 'Invoke-Build Build' first."
3638
return
3739
}
3840

39-
if (Get-Module quickpath) {
40-
Remove-Module quickpath -Force -ErrorAction SilentlyContinue
41+
if (Get-Module $moduleName) {
42+
Remove-Module $moduleName -Force -ErrorAction SilentlyContinue
4143
}
4244

4345
Import-Module $quickPathManifest -Force -ErrorAction Stop
44-
Write-Host "quickpath has been built, tested, and reloaded." -ForegroundColor Green
46+
Write-Host "$moduleName has been built, tested, and reloaded." -ForegroundColor Green
4547
}
4648
catch {
4749
Write-Error "An error occurred while updating from build: $($_.Exception.Message)"

0 commit comments

Comments
 (0)