Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow redirection of progress into stdout/file #8

Open
LinqLover opened this issue Jun 4, 2020 · 1 comment
Open

Allow redirection of progress into stdout/file #8

LinqLover opened this issue Jun 4, 2020 · 1 comment

Comments

@LinqLover
Copy link

In certain situations, for example in CI environments such as GitHub Actions or others, there is no host window that can display the progress bars generated by Write-Progress[Ex]. It would be nice if this mode could be activated or even auto-detected and all progress could then be redirected to stdout.

@mazzy-ax
Copy link
Owner

mazzy-ax commented Jun 5, 2020

Good point...

WriteProgressEx uses a pipe (and stdout) now.
See /Examples/Write-ProgressEx.pipe.ps1

You can also override the scriptblocks that show the messages
see /Examples/Write-ProgressEx.counter.ps1
screenshot

Write-ProgressEx params:

    # Message templates
    [scriptblock[]]$MessageOnFirstIteration,
    [scriptblock[]]$MessageOnNewActivity,
    [scriptblock[]]$MessageOnNewStatus,
    [scriptblock[]]$MessageOnCompleted,

    # The cmdlet output no messages
    [switch]$ShowMessages,
    [switch]$ShowMessagesOnFirstIteration = $ShowMessages -or $MessageOnFirstIteration,
    [switch]$ShowMessagesOnNewActivity = $ShowMessages -or $MessageOnNewActivity,
    [switch]$ShowMessagesOnNewStatus = $ShowMessages -or $MessageOnNewStatus,
    [switch]$ShowMessagesOnCompleted = $ShowMessages -or $MessageOnCompleted

PowerShell provides the Verbose Stream and Information Stream.
I need to think this streams.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants