Public/Open-WsCreatorCode.ps1
|
function Open-WsCreatorCode { <# .SYNOPSIS Opens VS Code (Remote-SSH) on the machine's ~/src. .PARAMETER Name The machine: folder <WS_CREATOR_MACHINES>\<Name>\, and the distro of the same name. .EXAMPLE ws-creator code my-machine .LINK https://github.com/akramgassem/ws-creator #> param([Parameter(Mandatory)][string]$Name) $m = Get-Machine $Name if (-not $m.Ssh) { throw "Machine '$($m.Name)' has no Ssh: VS Code connects through the ssh fragment" } if (-not (Get-Command code -ErrorAction SilentlyContinue)) { throw "VS Code command 'code' not found in PATH" } code --folder-uri "vscode-remote://ssh-remote+$($m.Name)/home/$($m.User)/src" } |