param([switch]$NoSync) $ErrorActionPreference = 'Stop' Set-Location $PSScriptRoot if (-not $NoSync) { ssh -o ConnectTimeout=3 -o BatchMode=yes jan@192.168.1.2 "exit" 2>$null if ($LASTEXITCODE -eq 0) { Write-Host "Syncing my_cars.json from moria (LAN) ..." scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json } else { Write-Host "moria unreachable - syncing my_cars.json from hunnius.net (remote) ..." scp -q jan@hunnius.net:Development/top_drives/my_cars.json .\my_cars.json } if ($LASTEXITCODE -ne 0) { throw "my_cars.json sync failed" } } Remove-Item .\*.csv -ErrorAction SilentlyContinue Write-Host "Fetching repo data (cars, tracks, times - first run takes a while) ..." cargo run --release --bin records -- fetch cargo run --release --bin records -- all --min-count 10 --max-wishlist 305 Write-Host "Done. CSVs are in $PSScriptRoot"