Skip to content
This repository was archived by the owner on Aug 22, 2022. It is now read-only.

Conversation

@X-Guardian
Copy link
Contributor

For each GitLab API call, the Invoke-WebRequest command displays a progress bar, which for a lot of calls, is only displayed for a fraction of a second. For a paginated call, multiple short-lived progress bars are displayed one after the other causing an annoying flickering on the PowerShell window.

I don't think these progress bars are useful, so suggest disabling them by setting the $ProgressPreference variable to SilentlyContinue during the Invoke-WebRequest calls as shown in this PR.

@ngetchell ngetchell merged commit 2729d09 into ngetchell:master Jul 31, 2018
@X-Guardian
Copy link
Contributor Author

Cheers @ngetchell. Are you planning to publish a new release to the PowerShell gallery?

Write-Error -Message "$($GitlabErrorText.message.base)"
}
finally {
$ProgressPreference = 'Continue'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will destroy whatever the user set before using one of the PSGitLab cmdlets.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing the variable is scoped to the function. The variable is gone after the function exists.

If you have a scenario where it would destroy the user preference let me know!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DHowett, the $ProgressPreference variable used in the module is definitely scoped to the module and won't affect the value of $Global:ProgressPreference. See About_Scopes for further info.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a shame there isn't anything in the Common Parameter set that can control progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, you're totally right. Thanks/sorry!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants