Created
July 1, 2017 02:51
-
-
Save wsmelton/718740f58b141a6a23241fecab4641c1 to your computer and use it in GitHub Desktop.
Generate Content View utilizing VS Code from an input object
This file contains 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
<# | |
.SYNOPISIS | |
Generate an HTML view that will open in an editor for VS Code | |
.NOTES | |
Add this to your Microsoft.VSCode_profile.ps1 file | |
.EXAMPLE | |
$results = Get-DbaSpConfigure -SqlInstance manatarms | |
Out-CodeView $results | |
#> | |
function Out-CodeView { | |
param([object]$InputObject, [int]$colNum = 1) | |
$v = New-VSCodeHtmlContentView -Title "Untitled $(Get-Random)" -ShowInColumn $colNum | |
$c = ($InputObject | ConvertTo-Html -Fragment) -join "`r`n" | |
Set-VSCodeHtmlContentView -HtmlContentView $v -HtmlBodyContent $c | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment