Package creation template and scoop package
Set-MyPackage has a template option that will create skelaton content when a new package is created. Add scoop package, so that refresh will occur automatically on powershell launch if it hasn't been run in the past 3 hours.
This commit is contained in:
parent
4ba9a69fb9
commit
1672c384ad
4 changed files with 40 additions and 4 deletions
scoop
BIN
scoop/_.package.json
Normal file
BIN
scoop/_.package.json
Normal file
Binary file not shown.
20
scoop/profile.d/smart-refresh-on-startup.ps1
Normal file
20
scoop/profile.d/smart-refresh-on-startup.ps1
Normal file
|
@ -0,0 +1,20 @@
|
|||
$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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue