20 lines
586 B
PowerShell
20 lines
586 B
PowerShell
$local:whenLast = $null
|
|
$local:whenLastSavePath = $(Join-Path $env:SCOOP last-scoop-refresh.clixml)
|
|
|
|
if( Test-Path $whenLastSavePath ) {
|
|
$whenLast = Import-Clixml -LiteralPath $whenLastSavePath
|
|
}
|
|
|
|
if( $whenLast ) {
|
|
$local:TimePassed = (Get-Date) - $local:whenLast
|
|
if( $TimePassed.TotalHours -ge 3 ) {
|
|
$whenLast = $null
|
|
} else {
|
|
Write-Host -ForegroundColor Yellow "Only $(ConvertFrom-TimeSpan $TimePassed) has passed, skipping scoop refresh."
|
|
}
|
|
}
|
|
|
|
if( -not $whenLast ) {
|
|
scoop refresh
|
|
$whenLast | Export-Clixml -LiteralPath $whenLastSavePath
|
|
} |