You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chajia/scripts/record-mothership.ps1

34 lines
870 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Windows 录制入口(无需 bash/WSL
# Usage:
# npm run record:mothership
# npm run record:mothership -- --logged-in
# powershell -ExecutionPolicy Bypass -File scripts/record-mothership.ps1 -LoggedIn
# powershell -ExecutionPolicy Bypass -File scripts/record-mothership.ps1 -StartUrl "https://..." -LoggedIn
param(
[string]$StartUrl,
[switch]$LoggedIn
)
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent $PSScriptRoot
Push-Location $Root
try {
if ($LoggedIn -and $StartUrl) {
npm run record:mothership -- --logged-in $StartUrl
}
elseif ($LoggedIn) {
npm run record:mothership -- --logged-in
}
elseif ($StartUrl) {
npm run record:mothership -- $StartUrl
}
else {
npm run record:mothership
}
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
finally {
Pop-Location
}