Skip to content

show text like a progressbar  #15

@632575987

Description

@632575987

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"

abc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions