-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathluo.ps1
31 lines (26 loc) · 833 Bytes
/
luo.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function Get-ScriptRoot {
$result = $PSScriptRoot
if ($result.Length -eq 0) {
$result = split-path -parent $MyInvocation.MyCommand.Definition
}
return $result
}
function Set-LuoPath {
$test_path = ([System.Environment]::GetEnvironmentVariable('PATH') | findstr (Get-ScriptRoot)).Length
if ($test_path -eq 0) {
[System.Environment]::SetEnvironmentVariable('PATH', "${Env:PATH};" + (Get-ScriptRoot))
$Env:PATH += ";" + (Get-ScriptRoot)
Write-Host "=== PATH set for Luo ==="
}
}
Set-LuoPath
if ($args[0] -eq "update") {
Write-Host "Pulling the latest Docker image..."
docker pull ghcr.io/mjason/luo:latest
}
Write-Host "Running the Docker container..."
docker run --rm -it `
-p 8888:8888 `
-v "${PWD}:/workdir" `
ghcr.io/mjason/luo:latest `
$args