Formatting and agility
skip scoop in VSCode Fix CovertFrom-TimeSpan to handle series and FieldName
This commit is contained in:
parent
c9d13f5c4d
commit
2f317c53f3
|
@ -1,15 +1,24 @@
|
||||||
param([TimeSpan]$TimeSpan, [switch]$NoSeconds)
|
[CmdletBinding()]param(
|
||||||
$local:out = [string]::Empty
|
[Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
|
||||||
if( $TimeSpan.Days ) {
|
[Alias("Elapsed")]
|
||||||
$out = "$($TimeSpan.Days)d "
|
[TimeSpan]$TimeSpan,
|
||||||
}
|
[switch]$NoSeconds
|
||||||
if( $out -or $TimeSpan.Hours ) {
|
)
|
||||||
$out += "$($TimeSpan.Hours)h "
|
process {
|
||||||
}
|
foreach( $local:ts in $TimeSpan ) {
|
||||||
if( $out -or $TimeSpan.Minutes -or ($NoSeconds -and -not $out) ) {
|
$local:out = [string]::Empty
|
||||||
$out += "$($TimeSpan.Minutes)m "
|
if( $ts.Days ) {
|
||||||
}
|
$out = "$($ts.Days)d "
|
||||||
if( -not $NoSeconds -and ($TimeSpan.Seconds -or -not $out) ) {
|
}
|
||||||
$out += "$($TimeSpan.Seconds)s"
|
if( $out -or $ts.Hours ) {
|
||||||
}
|
$out += "$($ts.Hours)h "
|
||||||
$out.Trim();
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
scoop autocomplete-on
|
scoop autocomplete-on
|
||||||
|
|
||||||
if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) {
|
if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) {
|
||||||
scoop refresh
|
if($Host.Name -ne 'Visual Studio Code Host' ) {
|
||||||
|
scoop refresh
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Warning ("No recorded time for last 'scoop refresh', to remedy, run 'scoop refresh' at least once manually." +
|
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.")
|
"`nIf the issue still persists, please run 'scoop alias-update' to update to latest refresh code, and try again.")
|
||||||
|
|
Loading…
Reference in New Issue