diff --git a/base/ConvertFrom-TimeSpan.ps1 b/base/ConvertFrom-TimeSpan.ps1 index 1c10416..4656b53 100644 --- a/base/ConvertFrom-TimeSpan.ps1 +++ b/base/ConvertFrom-TimeSpan.ps1 @@ -1,15 +1,24 @@ -param([TimeSpan]$TimeSpan, [switch]$NoSeconds) -$local:out = [string]::Empty -if( $TimeSpan.Days ) { - $out = "$($TimeSpan.Days)d " -} -if( $out -or $TimeSpan.Hours ) { - $out += "$($TimeSpan.Hours)h " -} -if( $out -or $TimeSpan.Minutes -or ($NoSeconds -and -not $out) ) { - $out += "$($TimeSpan.Minutes)m " -} -if( -not $NoSeconds -and ($TimeSpan.Seconds -or -not $out) ) { - $out += "$($TimeSpan.Seconds)s" -} -$out.Trim(); +[CmdletBinding()]param( + [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)] + [Alias("Elapsed")] + [TimeSpan]$TimeSpan, + [switch]$NoSeconds +) +process { + foreach( $local:ts in $TimeSpan ) { + $local:out = [string]::Empty + if( $ts.Days ) { + $out = "$($ts.Days)d " + } + if( $out -or $ts.Hours ) { + $out += "$($ts.Hours)h " + } + if( $out -or $ts.Minutes -or ($NoSeconds -and -not $out) ) { + $out += "$($ts.Minutes)m " + } + if( -not $NoSeconds -and ($ts.Seconds -or -not $out) ) { + $out += "$($ts.Seconds)s" + } + $out.Trim(); + } +} \ No newline at end of file diff --git a/scoop/profile.d/smart-refresh-on-startup.ps1 b/scoop/profile.d/smart-refresh-on-startup.ps1 index 4c90375..8e30394 100644 --- a/scoop/profile.d/smart-refresh-on-startup.ps1 +++ b/scoop/profile.d/smart-refresh-on-startup.ps1 @@ -1,7 +1,9 @@ scoop autocomplete-on if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) { - scoop refresh + if($Host.Name -ne 'Visual Studio Code Host' ) { + scoop refresh + } } else { Write-Warning ("No recorded time for last 'scoop refresh', to remedy, run 'scoop refresh' at least once manually." + "`nIf the issue still persists, please run 'scoop alias-update' to update to latest refresh code, and try again.")