Skip to content

Commit 245338d

Browse files
authored
Merge pull request #1 from Davlind/master
Get updated wrapper functions
2 parents 0e7bc2b + 1ad2bc1 commit 245338d

File tree

4 files changed

+64
-710
lines changed

4 files changed

+64
-710
lines changed

release/PSColor.psm1

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Add-Type -assemblyname System.ServiceProcess
77
. "$PSScriptRoot\MatchInfo.ps1"
88
. "$PSScriptRoot\ProcessInfo.ps1"
99

10-
11-
1210
$global:PSColor = @{
1311
File = @{
1412
Default = @{ Color = 'White' }
@@ -34,28 +32,78 @@ $global:PSColor = @{
3432

3533
$script:showHeader=$true
3634

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},
3840

39-
if(($_ -is [System.IO.DirectoryInfo]) -or ($_ -is [System.IO.FileInfo]))
41+
[Parameter(Position=0, ValueFromPipeline=$true)]
42+
[psobject]
43+
${InputObject})
44+
45+
begin
4046
{
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+
}
4361
}
4462

45-
elseif($_ -is [System.ServiceProcess.ServiceController])
63+
process
4664
{
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+
}
4989
}
5090

51-
elseif($_ -is [Microsoft.Powershell.Commands.MatchInfo])
91+
end
5292
{
53-
MatchInfo $_
54-
$_ = $null
93+
try {
94+
write-host ""
95+
$script:showHeader=$true
96+
$steppablePipeline.End()
97+
} catch {
98+
throw
99+
}
55100
}
56-
} -end {
57-
write-host ""
58-
$script:showHeader=$true
101+
<#
102+
103+
.ForwardHelpTargetName Out-Default
104+
.ForwardHelpCategory Function
105+
106+
#>
59107
}
60108

61-
Export-ModuleMember
109+
Export-ModuleMember Out-Default

release/PSColor.zip

-2.56 KB
Binary file not shown.

0 commit comments

Comments
 (0)