@@ -7,8 +7,6 @@ Add-Type -assemblyname System.ServiceProcess
7
7
. " $PSScriptRoot \MatchInfo.ps1"
8
8
. " $PSScriptRoot \ProcessInfo.ps1"
9
9
10
-
11
-
12
10
$global :PSColor = @ {
13
11
File = @ {
14
12
Default = @ { Color = ' White' }
@@ -34,28 +32,78 @@ $global:PSColor = @{
34
32
35
33
$script :showHeader = $true
36
34
37
- New-CommandWrapper Out-Default - Process {
35
+ function Out-Default {
36
+ [CmdletBinding (HelpUri = ' http://go.microsoft.com/fwlink/?LinkID=113362' , RemotingCapability= ' None' )]
37
+ param (
38
+ [switch ]
39
+ ${Transcript} ,
38
40
39
- if (($_ -is [System.IO.DirectoryInfo ]) -or ($_ -is [System.IO.FileInfo ]))
41
+ [Parameter (Position = 0 , ValueFromPipeline = $true )]
42
+ [psobject ]
43
+ ${InputObject} )
44
+
45
+ begin
40
46
{
41
- FileInfo $_
42
- $_ = $null
47
+ try {
48
+ $outBuffer = $null
49
+ if ($PSBoundParameters.TryGetValue (' OutBuffer' , [ref ]$outBuffer ))
50
+ {
51
+ $PSBoundParameters [' OutBuffer' ] = 1
52
+ }
53
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand (' Microsoft.PowerShell.Core\Out-Default' , [System.Management.Automation.CommandTypes ]::Cmdlet)
54
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters }
55
+
56
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline ()
57
+ $steppablePipeline.Begin ($PSCmdlet )
58
+ } catch {
59
+ throw
60
+ }
43
61
}
44
62
45
- elseif ( $_ -is [ System.ServiceProcess.ServiceController ])
63
+ process
46
64
{
47
- ServiceController $_
48
- $_ = $null
65
+ try {
66
+ if (($_ -is [System.IO.DirectoryInfo ]) -or ($_ -is [System.IO.FileInfo ]))
67
+ {
68
+ FileInfo $_
69
+ $_ = $null
70
+ }
71
+
72
+ elseif ($_ -is [System.ServiceProcess.ServiceController ])
73
+ {
74
+ ServiceController $_
75
+ $_ = $null
76
+ }
77
+
78
+ elseif ($_ -is [Microsoft.Powershell.Commands.MatchInfo ])
79
+ {
80
+ MatchInfo $_
81
+ $_ = $null
82
+ }
83
+ else {
84
+ $steppablePipeline.Process ($_ )
85
+ }
86
+ } catch {
87
+ throw
88
+ }
49
89
}
50
90
51
- elseif ( $_ -is [ Microsoft.Powershell.Commands.MatchInfo ])
91
+ end
52
92
{
53
- MatchInfo $_
54
- $_ = $null
93
+ try {
94
+ write-host " "
95
+ $script :showHeader = $true
96
+ $steppablePipeline.End ()
97
+ } catch {
98
+ throw
99
+ }
55
100
}
56
- } - end {
57
- write-host " "
58
- $script :showHeader = $true
101
+ <#
102
+
103
+ . ForwardHelpTargetName Out-Default
104
+ . ForwardHelpCategory Function
105
+
106
+ #>
59
107
}
60
108
61
- Export-ModuleMember
109
+ Export-ModuleMember Out-Default
0 commit comments