Skip to content

Instantly share code, notes, and snippets.

@dfbaskin
Created August 31, 2020 11:49
Show Gist options
  • Save dfbaskin/033f8c81582fd310a428e302a60dca7c to your computer and use it in GitHub Desktop.
Save dfbaskin/033f8c81582fd310a428e302a60dca7c to your computer and use it in GitHub Desktop.
Use Powershell Core and Microsoft Terminal to open node and dotnet application side-by-side.
param (
$shellName = 'pwsh'
)
$commands = @(
[PSCustomObject]@{
Path = 'my-node-project'
Command = 'npm.cmd start'
Window = 'new-tab'
}
[PSCustomObject]@{
Path = 'my-dotnet-project'
Command = 'dotnet.exe watch run'
Window = 'split-pane'
}
)
$argList = $commands |
ForEach-Object {
$cmd = $_
$fullPath = Join-Path $PSScriptRoot $cmd.Path -Resolve
@(
$cmd.Window
"-p $shellName"
"-d $fullPath"
"pwsh -noexit -command $($cmd.Command)"
) -join " "
} |
Join-String -Separator " ; "
Start-Process -FilePath "wt.exe" -ArgumentList $argList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment