-
Notifications
You must be signed in to change notification settings - Fork 191
Implement -PassThru
for all Set-*
cmdlets
#217
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
Comments
Actually, for your sample code, you'd need it to be: $result = Invoke-GHRestMethod @params
if ($PassThru)
{
return $result
} The way you wrote it, you'd still behave using PassThru even if someone supplied |
This is an interesting idea. I think I like it. The main issue with it is that it would be a breaking change for users. There are a lot of breaking changes lately, and I'm trying to be conscious about that. We just added a breaking change with the I think that this could be done in a phased approach. Phase 1: Add the Leaving this open for discussion to hear other people's thoughts on this Issue's suggestion in general, as well as the phased approach due to the breaking change. |
Oh yeah sorry it should be: $result = Invoke-GHRestMethod @params
if ($PassThru.IsPresent)
{
return $result
} since it's a switch parameter... that way it works in PowerShell strict mode lol |
…ssThru) All state-changing commands (with the exception of New-*) are now silent by default. Users can pass-in `-PassThru` to make them return the result that used to be returned by default. Users can revert back to the previous behavior by leveraging the new configuration value: DefaultPassThru. Resolves microsoft#217
Decided to just implement this anyway, since the next release is already going to be full of breaking changes. |
…ssThru) All state-changing commands (with the exception of New-*) are now silent by default. Users can pass-in `-PassThru` to make them return the result that used to be returned by default. Users can revert back to the previous behavior by leveraging the new configuration value: DefaultPassThru. Resolves microsoft#217
…ssThru) (#276) All state-changing commands (with the exception of `New-*`) are now silent by default. Users can pass-in `-PassThru` to make them return the result that used to be returned by default. Users can revert back to the previous behavior by leveraging the new configuration value: `DefaultPassThru`. Resolves #217
Feature Idea Summary
It's usually good practice for
Set-*
cmdlets to output nothing and then offer a-PassThru
to output the result.This allows output to not be as noisy and so that you don't have to pipe to
Out-Null
Feature Idea Additional Details
All this would mean is:
-PassThru
parameter to allSet-*
functionsRequested Assignment
I'm just suggesting this idea, at this time. I'm not planning on implementing it.
The text was updated successfully, but these errors were encountered: