-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Could you provide a switch to control the display position, such as the progress bar, the text is only displayed on one line and can be updated. I know that the vt100 control character can realize this function, but I don't know how to modularize it.
It would be even better if the time display function could be integrated.❤️ such as:
write-color "you have waited " -c green -b blue -NoNewLine -NoAppend -ShowClock
$esc=[char]27
$rp="$esc[50G"
$sw=[Diagnostics.StopWatch]::StartNew()
$tm=New-Object System.Timers.Timer
$tm.Interval=1000
Register-ObjectEvent -InputObject $tm -EventName Elapsed -Action {
#$dt=(get-date).tostring("yyyyMMdd HHmmss");
$ep=$sw.Elapsed
#$host.ui.RawUI.WindowTitle = $ep;
write-color "$rp$ep" -C Yellow -B Blue -NoNewline
}|Out-Null
$tm.AutoReset=$true
$tm.Enabled=$true
1..10|foreach-object {$host.ui.RawUI.WindowTitle = $_;start-sleep 1;}
$tm.Enabled=$false
$sw.stop()
read-host "done"
Metadata
Metadata
Assignees
Labels
No labels
