Skip to content

Commit d195694

Browse files
authored
Merge pull request #5 from poshcodebear/dev
v1.0.1 - Fix remove bug
2 parents 829d9ef + 00f1a74 commit d195694

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

EasyProgressBars/Class.ProgressBar.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class ProgressBar
77
[DateTime] $StartTime
88
[int] $TotalCount
99
[int] $Iteration
10+
11+
hidden [Guid] $Guid
1012
#endregion
1113

1214
#region Static Properties
@@ -92,6 +94,7 @@ class ProgressBar
9294
$this.Id = [ProgressBar]::GetNextStackId()
9395
$this.Iteration = 0
9496
$this.View = $View
97+
$this.Guid = New-Guid
9598

9699
[ProgressBar]::ProgressBarStack += $this
97100
}
@@ -150,15 +153,18 @@ class ProgressBar
150153
return "($($this.Id)) $($this.Activity) [$($this.Iteration)/$($this.TotalCount)]"
151154
}
152155
[void] Dispose()
153-
{ $this.Dispose(2) }
156+
{ $this.Dispose(3) }
154157
[void] hidden Dispose([int] $Depth)
155158
{
156159
$this.Children.foreach({$_.Dispose($Depth + 1)})
157160

158161
[ProgressBar]::ProgressBarStack.Remove($this)
159162

160-
$references = (Get-Variable -Scope $Depth).where({$_.Value -is [ProgressBar] -and $_.Value.Id -eq $this.Id})
161-
Remove-Variable -Name $references.Name -Scope $Depth
163+
(Get-Variable).where({
164+
$_.Value -is [ProgressBar] -and
165+
$_.GetType().Name -eq 'PSVariable' -and
166+
$_.Value.Guid -eq $this.Guid
167+
}) | Remove-Variable -Scope $Depth
162168
}
163169
#endregion
164170

EasyProgressBars/EasyProgressBars.psd1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Laurel Lowery, a.k.a. The PowerShell Bear
55
#
6-
# Generated on: 2022-11-16
6+
# Generated on: 2023-03-22
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.0.0'
15+
ModuleVersion = '1.0.1'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -96,19 +96,19 @@ PrivateData = @{
9696
PSData = @{
9797

9898
# Tags applied to this module. These help with module discovery in online galleries.
99-
# Tags = @()
99+
Tags = @('Progress', 'ProgressBars', 'Write-Progress', 'Timer')
100100

101101
# A URL to the license for this module.
102102
LicenseUri = 'https://raw.githubusercontent.com/poshcodebear/EasyProgressBars/main/LICENSE'
103103

104104
# A URL to the main website for this project.
105-
# ProjectUri = ''
105+
ProjectUri = 'https://github.com/poshcodebear/EasyProgressBars'
106106

107107
# A URL to an icon representing this module.
108108
# IconUri = ''
109109

110110
# ReleaseNotes of this module
111-
# ReleaseNotes = ''
111+
ReleaseNotes = 'https://github.com/poshcodebear/EasyProgressBars/releases/tag/v1.0.1'
112112

113113
# Prerelease string of this module
114114
# Prerelease = ''

EasyProgressBars/ProgressBar.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function Remove-ProgressBar
9090
{
9191
if ($PSCmdlet.ShouldProcess($bar, 'Remove ProgressBar'))
9292
{
93-
$bar.Dispose(2)
93+
$bar.Dispose(3)
9494
}
9595
}
9696
}

ManifestGeneration.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $ManifestSplat = @{
44
# Module details:
55
Author = 'Laurel Lowery, a.k.a. The PowerShell Bear'
66
Description = 'Helper functions to make setting up progress bars to track progress simple and straightforward'
7-
ModuleVersion = '1.0.0'
7+
ModuleVersion = '1.0.1'
88
PowerShellVersion = '7.2'
99

1010
# Exports:

0 commit comments

Comments
 (0)