Skip to content

Commit aaca76f

Browse files
rkeithhilldaviwil
authored andcommitted
Add command to get pertinent version info.
1 parent 15467aa commit aaca76f

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

module/PowerShellEditorServices/PowerShellEditorServices.psd1

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Copyright = '(c) 2016 Microsoft. All rights reserved.'
6666
# NestedModules = @()
6767

6868
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
69-
FunctionsToExport = @('Start-EditorServicesHost')
69+
FunctionsToExport = @('Start-EditorServicesHost', 'Get-PowerShellEditorServicesVersion')
7070

7171
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
7272
CmdletsToExport = @()

module/PowerShellEditorServices/PowerShellEditorServices.psm1

+30-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,33 @@ function Start-EditorServicesHost {
9494
}
9595

9696
return $editorServicesHost
97-
}
97+
}
98+
99+
function Get-PowerShellEditorServicesVersion {
100+
$nl = [System.Environment]::NewLine
101+
102+
$versionInfo = "PSVersionTable:`n$($PSVersionTable | Out-String)" -replace '\n$', ''
103+
104+
if ($IsLinux) {
105+
$versionInfo += "Linux version: $(lsb_release -d)$nl"
106+
}
107+
elseif ($IsOSX) {
108+
$versionInfo += "macOS version: $(lsb_release -d)$nl"
109+
}
110+
else {
111+
$versionInfo += "Windows version: $(Get-CimInstance Win32_OperatingSystem | Foreach-Object Version)$nl"
112+
}
113+
114+
$versionInfo += $nl
115+
116+
$OFS = ", "
117+
$versionInfo += "VSCode version: $(code -v)$nl"
118+
$OFS = "$nl "
119+
$versionInfo += "VSCode extensions:$nl $(code --list-extensions --show-versions)"
120+
121+
if (!$IsLinux -and !$IsOSX) {
122+
$versionInfo | Microsoft.PowerShell.Management\Set-Clipboard
123+
}
124+
125+
$versionInfo
126+
}

0 commit comments

Comments
 (0)