@@ -8,17 +8,13 @@ $Global:GetChildItemColorVerticalSpace = 1
88Function Get-FileColor ($Item ) {
99 $Key = ' Default'
1010
11- if ([bool ]($Item.Attributes -band [IO.FileAttributes ]::ReparsePoint)) {
11+ If ([bool ]($Item.Attributes -band [IO.FileAttributes ]::ReparsePoint)) {
1212 $Key = ' Symlink'
13- } Else {
14- If ($Item.GetType ().Name -eq ' DirectoryInfo' ) {
15- $Key = ' Directory'
16- } Else {
17- If ($Item.PSobject.Properties.Name -contains " Extension" ) {
18- If ($GetChildItemColorTable.File.ContainsKey ($Item.Extension )) {
19- $Key = $Item.Extension
20- }
21- }
13+ } ElseIf ($Item.GetType ().Name -eq ' DirectoryInfo' ) {
14+ $Key = ' Directory'
15+ } ElseIf ($Item.PSobject.Properties.Name -contains " Extension" ) {
16+ If ($GetChildItemColorTable.File.ContainsKey ($Item.Extension )) {
17+ $Key = $Item.Extension
2218 }
2319 }
2420
@@ -140,79 +136,70 @@ Add-Type -assemblyname System.ServiceProcess
140136. " $PSScriptRoot \MatchInfo.ps1"
141137. " $PSScriptRoot \ProcessInfo.ps1"
142138
143- $script :showHeader = $true
139+ $Script :ShowHeader = $True
144140
145- function Out-Default {
141+ Function Out-Default {
146142 [CmdletBinding (HelpUri = ' http://go.microsoft.com/fwlink/?LinkID=113362' , RemotingCapability= ' None' )]
147143 param (
148- [switch ]
149- ${Transcript} ,
150-
151- [Parameter (Position = 0 , ValueFromPipeline = $true )]
152- [psobject ]
153- ${InputObject} )
144+ [switch ] ${Transcript} ,
145+ [Parameter (Position = 0 , ValueFromPipeline = $True )] [psobject ] ${InputObject}
146+ )
154147
155- begin
156- {
157- try {
148+ Begin {
149+ Try {
158150 For ($l = 1 ; $l -lt $GetChildItemColorVerticalSpace ; $l ++ ) {
159151 Write-Host " "
160152 }
161153
162154 $outBuffer = $null
163- if ($PSBoundParameters.TryGetValue (' OutBuffer' , [ref ]$outBuffer ))
164- {
155+ If ($PSBoundParameters.TryGetValue (' OutBuffer' , [ref ]$outBuffer )) {
165156 $PSBoundParameters [' OutBuffer' ] = 1
166157 }
167158 $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand (' Microsoft.PowerShell.Core\Out-Default' , [System.Management.Automation.CommandTypes ]::Cmdlet)
168159 $scriptCmd = {& $wrappedCmd @PSBoundParameters }
169160
170161 $steppablePipeline = $scriptCmd.GetSteppablePipeline ()
171162 $steppablePipeline.Begin ($PSCmdlet )
172- } catch {
173- throw
163+ } Catch {
164+ Throw
174165 }
175166 }
176167
177- process
178- {
179- try {
180- if (($_ -is [System.IO.DirectoryInfo ]) -or ($_ -is [System.IO.FileInfo ]))
181- {
168+ Process {
169+ Try {
170+ If (($_ -is [System.IO.DirectoryInfo ]) -or ($_ -is [System.IO.FileInfo ])) {
182171 FileInfo $_
183- $_ = $null
172+ $_ = $Null
184173 }
185174
186- elseif ($_ -is [System.ServiceProcess.ServiceController ])
187- {
175+ ElseIf ($_ -is [System.ServiceProcess.ServiceController ]) {
188176 ServiceController $_
189- $_ = $null
177+ $_ = $Null
190178 }
191179
192- elseif ($_ -is [Microsoft.Powershell.Commands.MatchInfo ])
193- {
180+ ElseIf ($_ -is [Microsoft.Powershell.Commands.MatchInfo ]) {
194181 MatchInfo $_
195182 $_ = $null
196183 }
197- else {
184+ Else {
198185 $steppablePipeline.Process ($_ )
199186 }
200- } catch {
201- throw
187+ } Catch {
188+ Throw
202189 }
203190 }
204191
205- end
192+ End
206193 {
207- try {
194+ Try {
208195 For ($l = 1 ; $l -le $GetChildItemColorVerticalSpace ; $l ++ ) {
209196 Write-Host " "
210197 }
211198
212- $script :showHeader = $true
199+ $Script :ShowHeader = $true
213200 $steppablePipeline.End ()
214- } catch {
215- throw
201+ } Catch {
202+ Throw
216203 }
217204 }
218205 <#
0 commit comments