-
-
Save aldrichtr/9e5fa4585024d96dba7f92c68f793e79 to your computer and use it in GitHub Desktop.
Format file to add links to Select-String outputs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <Configuration> | |
| <ViewDefinitions> | |
| <View> | |
| <Name>MatchInfo</Name> | |
| <ViewSelectedBy> | |
| <TypeName>Microsoft.PowerShell.Commands.MatchInfo</TypeName> | |
| </ViewSelectedBy> | |
| <CustomControl> | |
| <CustomEntries> | |
| <CustomEntry> | |
| <CustomItem> | |
| <ExpressionBinding> | |
| <ScriptBlock> | |
| $currentDir = (Get-Location).Path | |
| $relativePath = $_.RelativePath($currentDir) | |
| $originalLine = $_.ToEmphasizedString($currentDir) | |
| if ($_.Path -and ($_.Path -ne 'InputStream')) | |
| { | |
| $linkString = $PSStyle.FormatHyperlink($relativePath, $_.Path) | |
| $originalLine.Replace($relativePath, $linkString) | |
| } | |
| else | |
| { | |
| $originalLine | |
| } | |
| </ScriptBlock> | |
| </ExpressionBinding> | |
| </CustomItem> | |
| </CustomEntry> | |
| </CustomEntries> | |
| </CustomControl> | |
| </View> | |
| </ViewDefinitions> | |
| </Configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment