Containers/Get-ContainerFromLaunchJson.ps1
function Get-ContainerFromLaunchJson { param ( # Path to launch.json [Parameter(Mandatory=$false)] [string] $LaunchJsonPath = (Join-Path (Get-Location) '.vscode\launch.json') ) if (!(Test-Path $LaunchJsonPath)) { return '' } $LaunchJson = ConvertFrom-Json (Get-Content $LaunchJsonPath -Raw) if ($LaunchJson.configurations.Count -ne 1) { return '' } else { $Container = $LaunchJson.configurations.Item(0).server $Container = $Container.Substring($Container.IndexOf('//') + 2) $Container } } Export-ModuleMember -Function Get-ContainerFromLaunchJson |