23 lines
610 B
PowerShell
23 lines
610 B
PowerShell
# CASAN_MANAGED_PROMPT_ENTRYPOINT
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(ValueFromRemainingArguments = $true)]
|
|
[string[]] $Prompt,
|
|
[string] $Distro = 'Ubuntu'
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$projectRootWindows = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
|
$projectRootWsl = (& wsl.exe -d $Distro -- wslpath -a $projectRootWindows).Trim()
|
|
if (-not $projectRootWsl) {
|
|
throw 'CASAN could not resolve the project path in WSL2.'
|
|
}
|
|
|
|
$arguments = @('-d', $Distro, '--cd', $projectRootWsl, './bin/casan-chat')
|
|
if ($Prompt) {
|
|
$arguments += $Prompt
|
|
}
|
|
|
|
& wsl.exe @arguments
|
|
exit $LASTEXITCODE
|