Skip to content

Commit

Permalink
Merge pull request #211 from StartAutomating/EZ-Fixes
Browse files Browse the repository at this point in the history
EZOut 2.0.5
  • Loading branch information
StartAutomating authored Mar 8, 2024
2 parents 258b434 + 15bca20 commit 9f4c082
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 34 deletions.
8 changes: 6 additions & 2 deletions Commands/Format.PS1XML/Write-FormatListView.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@
elseif ($styleProp -match '\.') {
$targetObject = $psStyle
foreach ($dotProperty in $styleProp -split '(?<!\.)\.') {
if ($targetObject.Item -is [Management.Automation.PSMethodInfo] -or
$targetObject -is [Collections.IDictionary]) {
if (
($targetObject.psobject.Members['Item'] -and
($targetObject.Item -is [Management.Automation.PSMethodInfo])
) -or
$targetObject -is [Collections.IDictionary]
) {
$targetObject = $targetObject[$dotProperty]
} else {
$targetObject = $targetObject.$dotProperty
Expand Down
8 changes: 6 additions & 2 deletions Commands/Format.PS1XML/Write-FormatTableView.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,12 @@ function Write-FormatTableView
elseif ($styleProp -match '\.') {
$targetObject = $psStyle
foreach ($dotProperty in $styleProp -split '(?<!\.)\.') {
if ($targetObject.Item -is [Management.Automation.PSMethodInfo] -or
$targetObject -is [Collections.IDictionary]) {
if (
($targetObject.psobject.Members['Item'] -and
($targetObject.Item -is [Management.Automation.PSMethodInfo])
) -or
$targetObject -is [Collections.IDictionary]
) {
$targetObject = $targetObject[$dotProperty]
} else {
$targetObject = $targetObject.$dotProperty
Expand Down
8 changes: 6 additions & 2 deletions Commands/Format.PS1XML/Write-FormatViewExpression.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@
elseif ($styleProp -match '\.') {
$targetObject = $psStyle
foreach ($dotProperty in $styleProp -split '(?<!\.)\.') {
if ($targetObject.Item -is [Management.Automation.PSMethodInfo] -or
$targetObject -is [Collections.IDictionary]) {
if (
($targetObject.psobject.Members['Item'] -and
($targetObject.Item -is [Management.Automation.PSMethodInfo])
) -or
$targetObject -is [Collections.IDictionary]
) {
$targetObject = $targetObject[$dotProperty]
} else {
$targetObject = $targetObject.$dotProperty
Expand Down
2 changes: 1 addition & 1 deletion EZOut.format.ps1xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Generated with EZOut 2.0.4: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<!-- Generated with EZOut 2.0.5: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<Configuration>
<ViewDefinitions>
<View>
Expand Down
10 changes: 4 additions & 6 deletions EZOut.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
ModuleToProcess = 'EZOut.psm1'
ModuleVersion = '2.0.4'
ModuleVersion = '2.0.5'
GUID = 'cef786f0-8a0b-4a5d-a2c6-b433095354cd'
Author = 'James Brundage'
CompanyName = 'Start-Automating'
Expand Down Expand Up @@ -69,12 +69,10 @@

Tags = '.ps1xml', 'Format','Output','Types', 'Colorized'
ReleaseNotes = @'
## EZOut 2.0.4:
## EZOut 2.0.5:
* Write-FormatViewExpression/Write-FormatCustomView now support -Frame, -LeftIndent, -RightIndent, -FirstLineHanging, -FirstLineIndent ( Fixes #164 )
* Push-FormatData/Push-TypeData now create unique files per-process (Fixes #205 )
Thanks @NinMonkey !
* Improving Strict mode Tolerance (#210)
* Removing Mount error on multiple imports (#209)
---
Expand Down
29 changes: 9 additions & 20 deletions EZOut.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,19 @@ $executionContext.SessionState.PSVariable.Set(
)

Export-ModuleMember -Function * -Alias * -Variable $myModule.Name
$newPSDrive = $ExecutionContext.SessionState.InvokeCommand.GetCommand('New-PSDrive', 'Cmdlet')
if ($newPSDrive) {
try {
$newDriveSplat = @{Name = $myModule.Name;Scope = 'Global';PSProvider='FileSystem'}
$newDriveSplat.Root = $myModule | Split-Path
& $newPSDrive @newDriveSplat
} catch {
Write-Verbose "$_"
}

try {
$newDriveSplat = @{Name = $myModule.Name;Scope = 'Global';PSProvider='FileSystem';ErrorAction='Ignore'}
$newDriveSplat.Root = $myModule | Split-Path
New-PSDrive @newDriveSplat
} catch {
Write-Verbose "$_"
}

$myModule.OnRemove = {
$myModule = Get-Module EZOut
$debuggingTypeNames = $myModule.DebuggingTypeNames
if ($debuggingTypeNames) {

if ($debuggingTypeNames) {
foreach ($typeName in $debuggingTypeNames | Select-Object -Unique) {
try {
Remove-TypeData -TypeName $typeName -Confirm:$false -ErrorAction Ignore
Expand All @@ -79,13 +76,5 @@ $myModule.OnRemove = {
}
}
Clear-FormatData
Clear-TypeData
$removePSDrive = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Remove-PSDrive', 'Cmdlet')
if ($removePSDrive) {
try {
& $removePSDrive -Name $myModule.Name -Confirm:$false
} catch {
Write-Debug "$_"
}
}
Clear-TypeData
}
2 changes: 1 addition & 1 deletion EZOut.types.ps1xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Generated with EZOut 2.0.4: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<!-- Generated with EZOut 2.0.5: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<Types>
<Type>
<Name>EZOut.Invisible</Name>
Expand Down

0 comments on commit 9f4c082

Please sign in to comment.