File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 18
18
</ExpressionBinding >
19
19
<ExpressionBinding >
20
20
<ScriptBlock >
21
- "Hello World"
22
- if ($formatter = Get-Command "ConvertTo-Error$($ErrorView)" -ListImported) {
23
- & $formatter $_
21
+ if ($formatter = Get-Command "ConvertTo-Error*$($ErrorView)*" -ListImported) {
22
+ & @($formatter)[0] $_
24
23
} else {
25
24
ConvertTo-ErrorNormalView $_
26
25
}
Original file line number Diff line number Diff line change 5
5
CompanyName = ' PoshCode'
6
6
7
7
RootModule = ' ErrorView.psm1'
8
- FormatsToProcess = ' ErrorView.ps1xml'
9
8
ModuleVersion = ' 0.0.1'
10
9
CompatiblePSEditions = @ (" Core" , " Desktop" )
11
10
Original file line number Diff line number Diff line change
1
+ param (
2
+ [ArgumentCompleter ({ (Get-Command ConvertTo-Error * - ListImported).Name -replace " ConvertTo-Error(?:View)?(.*)(?:View)" , ' $1' })]
3
+ $ErrorView
4
+ )
5
+
6
+ # We need to overwrite the ErrorView
7
+ # So -PrependPath, instead of FormatsToProcess
8
+ Update-FormatData - PrependPath $PSScriptRoot \ErrorView.ps1xml
9
+
1
10
function Write-NativeCommandError {
2
11
[CmdletBinding ()]
3
12
param (
@@ -37,7 +46,6 @@ function Write-NativeCommandError {
37
46
$myinv.InvocationName + " : "
38
47
}
39
48
}
40
-
41
49
function ConvertTo-ErrorCategoryView {
42
50
[CmdletBinding ()]
43
51
param (
@@ -48,7 +56,6 @@ function ConvertTo-ErrorCategoryView {
48
56
$CurrentError.CategoryInfo.GetMessage ()
49
57
}
50
58
51
-
52
59
function ConvertTo-ErrorSimpleView {
53
60
[CmdletBinding ()]
54
61
param (
@@ -95,7 +102,6 @@ function ConvertTo-ErrorSimpleView {
95
102
}
96
103
}
97
104
}
98
-
99
105
function ConvertTo-ErrorNormalView {
100
106
[CmdletBinding ()]
101
107
param (
You can’t perform that action at this time.
0 commit comments