prod2u-remote.ps1 970 B

1234567891011121314151617181920
  1. param(
  2. [Parameter(Position=0)][ValidateSet('doctor','sync','snapshot','quick','td','full','status','fetch','logs','cancel','container-up','container-down','container-recreate')][string]$Command='status',
  3. [Parameter(ValueFromRemainingArguments=$true)][string[]]$Args
  4. )
  5. $ErrorActionPreference='Stop'
  6. $root = Split-Path -Parent $PSScriptRoot
  7. $invoke = Join-Path $root 'windows\invoke-remote.ps1'
  8. if (-not (Test-Path -LiteralPath $invoke)) { throw "missing remote implementation: $invoke" }
  9. switch ($Command) {
  10. 'doctor' { & (Join-Path $root 'windows\remote-doctor.ps1') @Args }
  11. 'status' { & (Join-Path $root 'windows\remote-status.ps1') @Args }
  12. 'sync' {
  13. # Exact commits stay on the authorized LAN. Preserve the current branch;
  14. # a failed SSH push must not silently publish to an unrelated HTTP host.
  15. & git push lan HEAD @Args
  16. }
  17. 'fetch' { & (Join-Path $root 'windows\sync-from-remote.ps1') @Args }
  18. default { & $invoke @Args }
  19. }
  20. exit $LASTEXITCODE