plugins/ezout/formats/MatchInfo.format.ps1xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0" encoding="utf-16"?>
<Configuration>
  <ViewDefinitions>
    <View>
      <Name>Microsoft.Powershell.Commands.MatchInfo</Name>
      <ViewSelectedBy>
        <TypeName>Microsoft.Powershell.Commands.MatchInfo</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <AutoSize />
        <TableHeaders>
          <TableColumnHeader>
            <Label>Path</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>LineNumber</Label>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Line</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
            if ($OMPPansiesModuleLoaded -and ($null -ne (get-variable OMPEZOutDefinitions)) -and $OMPConsoleHasANSI -and $Global:OMPEzOutPluginLoaded) {
                $revertcolor = New-Text -Object "" -ForegroundColor ((Get-OMPHostState).foreground) -ErrorAction:SilentlyContinue

                $PathOut = New-Text -Object ($_.RelativePath($pwd)) -Foregroundcolor $Global:OMPEZOutDefinitions['Match'].Path['Color']

                # Pansies likes to reset the default color to white for some reason, this resets the color correctly.
                [string]$finaloutput = $PathOut.ToString() + $revertcolor.ToString()
                $finaloutput
            }
            else {
                $_.RelativePath($pwd)
            }
        </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
            if ($OMPPansiesModuleLoaded -and ($null -ne (get-variable OMPEZOutDefinitions)) -and $OMPConsoleHasANSI -and $Global:OMPEzOutPluginLoaded) {
                $revertcolor = New-Text -Object "" -ForegroundColor ((Get-OMPHostState).foreground) -ErrorAction:SilentlyContinue
                $LineNumberOut = New-Text -Object ($_.LineNumber) -Foregroundcolor $Global:OMPEZOutDefinitions['Match'].LineNumber['Color']

                # Pansies likes to reset the default color to white for some reason, this resets the color correctly.
                [string]$finaloutput = $LineNumberOut.ToString() + $revertcolor.ToString()
                $finaloutput
            }
            else {
                $_.LineNumber
            }
        </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
            if ($OMPPansiesModuleLoaded -and ($null -ne (get-variable OMPEZOutDefinitions)) -and $OMPConsoleHasANSI -and $Global:OMPEzOutPluginLoaded ) {
                $revertcolor = New-Text -Object "" -ForegroundColor ((Get-OMPHostState).foreground) -ErrorAction:SilentlyContinue
                $startofright = $_.Matches.Index + $_.Matches.Value.Length
                $endofright = ($_.line.length - $startofright)
                $leftoutput = New-Text -Object ($_.Line).Substring(0,($_.Matches).Index) -Foregroundcolor $Global:OMPEZOutDefinitions['Match'].Line['Color']
                $matchoutput = New-Text -Object ($_.Matches).Value -Foregroundcolor $Global:OMPEZOutDefinitions['Match'].Match['Color']
                $rightoutput = New-Text -Object ($_.Line).Substring($startofright, $endofright) -Foregroundcolor $Global:OMPEZOutDefinitions['Match'].Line['Color']
                # Pansies likes to reset the default color to white for some reason, this resets the color correctly.
                [string]$finaloutput = $leftoutput.ToString() + $matchoutput.ToString() + $rightoutput.ToString() + $revertcolor.ToString()

                $finaloutput
            }
            else {
                $_.Line
            }
        </ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>