Skip to content

Commit 16019a5

Browse files
author
Friedrich Weinmann
committed
updates
1 parent 279e604 commit 16019a5

File tree

4 files changed

+7
-26
lines changed

4 files changed

+7
-26
lines changed

PSUtil/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- upd: Alias `ex` now points at `Export-PSFClixml`
1010
- upd: Alias `ix` now points at `Import-PSFClixml`
1111
- upd: Alias `spo` now points at `Select-PSFObject`
12+
- upd: Moved the list of default properties to expand using Expand-PSUObject to configuration
1213

1314
## Version 1.1.5.17 (2018-06-19)
1415
- new: Command Select-PSUObject - Select-Object in awesome.

PSUtil/functions/objects/Expand-PSUObject.ps1

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")]
2-
3-
function Expand-PSUObject
1+
function Expand-PSUObject
42
{
53
<#
64
.SYNOPSIS
@@ -36,9 +34,6 @@ function Expand-PSUObject
3634
3735
.PARAMETER InputObject
3836
The objects whose properties are to be expanded.
39-
40-
.PARAMETER RestoreDefaults
41-
Restores $DefaultExpandedProperties to the default list of property-names.
4237
4338
.EXAMPLE
4439
PS C:\> dir | exp
@@ -56,7 +51,6 @@ function Expand-PSUObject
5651
5752
Expands all properties from all objects returned by dir that match the string "name" ("PSChildName", "FullName", "Name", "BaseName" for directories)
5853
#>
59-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")]
6054
[CmdletBinding(DefaultParameterSetName = "Equals")]
6155
Param (
6256
[Parameter(Position = 0, ParameterSetName = "Equals")]
@@ -75,10 +69,7 @@ function Expand-PSUObject
7569

7670
[Parameter(ValueFromPipeline = $true)]
7771
[object]
78-
$InputObject,
79-
80-
[switch]
81-
$RestoreDefaults
72+
$InputObject
8273
)
8374

8475
Begin
@@ -97,12 +88,10 @@ function Expand-PSUObject
9788
$n9ZPiBh8CI = $Name
9889
$____found = $true
9990
}
100-
101-
# Restore to default if necessary
102-
if ($RestoreDefaults) { $global:DefaultExpandedProperties = @("Definition", "Guid", "DisinguishedName", "FullName", "Name", "Length") }
91+
$DefaultExpandedProperties = Get-PSFConfigValue -FullName 'PSutil.Expand.DefaultProperties'
10392
}
10493

105-
Process
94+
process
10695
{
10796
:main foreach ($Object in $InputObject)
10897
{
@@ -175,5 +164,4 @@ function Expand-PSUObject
175164
Write-PSFMessage -Level Debug -Message "Expanding Objects" -Tag end
176165
}
177166
}
178-
if (-not $global:DefaultExpandedProperties) { $global:DefaultExpandedProperties = @("Definition", "Guid", "DisinguishedName", "FullName", "Name", "Length") }
179167
Import-PSUAlias -Name "exp" -Command "Expand-PSUObject"

PSUtil/functions/objects/Register-PSUObjectConversion.ps1

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
$ScriptBlock
3838
)
3939

40-
begin
41-
{
42-
Write-PSFMessage -Level InternalComment -Message "Bound parameters: $($PSBoundParameters.Keys -join ", ")" -Tag 'debug', 'start', 'param'
43-
}
4440
process
4541
{
4642
$conversion = New-Object PSUtil.Object.ObjectConversionMapping -Property @{
@@ -50,10 +46,5 @@
5046
}
5147

5248
[PSUtil.Object.ObjectHost]::Conversions["$($From):$($To)".ToLower()] = $conversion
53-
54-
}
55-
end
56-
{
57-
5849
}
5950
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Set-PSFConfig -Module PSUtil -Name 'Help.Preference' -Value ([PSUtil.Configuration.HelpOption]::Window) -Initialize -Validation "PSUGetHelpOptions" -Handler { } -Description "The way in which help is shown when pressing the 'F1' key. Can be any of the following options: Short | Detailed | Examples | Full | Window | Online"
22
Set-PSFConfig -Module PSUtil -Name 'History.Preference' -Value ([PSUtil.Configuration.HistoryOption]::Session) -Initialize -Validation "PSUBrowseHistoryOptions" -Handler { } -Description "Where the system will retrieve input history when pressing the 'F7' key. Can be any of the following options: Session | Global. Session includes history since the process was started, Global will try to look up the history from PSReadline log-file instead"
3-
Set-PSFConfig -Module PSUtil -Name 'History.Limit' -Value (-1) -Initialize -Validation 'integer' -Handler { } -Description "The maximum number of history entries to show when pressing the 'F7' key. Negative numbers disable limit"
3+
Set-PSFConfig -Module PSUtil -Name 'History.Limit' -Value (-1) -Initialize -Validation 'integer' -Handler { } -Description "The maximum number of history entries to show when pressing the 'F7' key. Negative numbers disable limit"
4+
Set-PSFConfig -Module PSUtil -Name 'Expand.DefaultProperties' -Value "Definition", "Guid", "DisinguishedName", "FullName", "Name", "Length" -Initialize -Validation stringarray -Description "The properties Expand-PSUObject (exp) picks from by default"

0 commit comments

Comments
 (0)