Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add VerboseAction, DebugAction, ProgressAction, VerboseVariable, DebugVariable, and ProgressVariable common parameters #10238
Add VerboseAction, DebugAction, ProgressAction, VerboseVariable, DebugVariable, and ProgressVariable common parameters #10238
Changes from 40 commits
e996df8
fc21ea9
5429151
813f936
2717565
314bf05
9ee62ec
84a6eb1
9f50c65
3dfb20f
de65104
4531f36
5b101c6
a0e6e7f
d78f5bf
527e209
4440334
12b00d0
cbc54e5
716cc35
cde7ed2
20c96c0
d38e481
288e22d
497ab2b
c9fda28
4c635b7
9fda03f
82b638d
d166fb5
b04dd8a
aae169b
de32dd5
8d29bc0
a458143
18f19bf
ff1489b
c068c80
169d822
4f00c1b
c3b1932
2223f38
4ba4626
d196fe5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break if the target remote session is an older version and does not support the new common parameters. We will need to update PowerShell remote encoding to support this only for target versions that implement the new common parameters. See:
PowerShell/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs
Line 1103 in 0f6fe9b
PowerShell/src/System.Management.Automation/engine/hostifaces/Command.cs
Line 727 in 0f6fe9b
PowerShell/src/System.Management.Automation/engine/hostifaces/Parameter.cs
Line 227 in 0f6fe9b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PaulHigin, I'll look into this.
I would also appreciate your thoughts on this comment from earlier, because taking that approach should allow us to deprecate
-Verbose
and-Debug
(which will have questionable usefulness going forward with this change), while bringing their muscle memory and aliases forward, without breaking backwards compatibility, and it would be nice if we could replace-Verbose
and-Debug
to reduce unnecessary common parameters. That work could also be done independently, of course, but it is worth thinking about as part of this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand the comment. Can you provide an example? But it sounds like a separate issue that should be discussed apart from these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really quite simple. Consider something you might do today, such as this:
That gives you verbose output that is generated during module import.
Once this PR is finalized/merged, you could do the same like this:
But the original syntax would work as well.
Where the question comes into play is this: do we need both
-Verbose
and-VerboseAction
, or-Debug
and-DebugAction
?The latter is necessary to allow you to properly handle those streams like any other stream. The former is "necessary" for backwards compatibility and muscle memory. My point was that it is possible to support both of these with a single parameter, which would treat a switch-like invocation as if you invoked the corresponding
-*Action
parameter withContinue
.i.e.
Import-Module Microsoft.Graph -Verbose
would be the exact same as invokingImport-Module Microsoft.Graph -VerboseAction Continue
, by simply making the-VerboseAction
parameter "switchable" (the generic type I said could be written). This approach would allow the-Verbose
and-Debug
parameters to be gracefully deprecated as superceded by-VerboseAction
and-DebugAction
, respectively.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another data point that could influence this: using
-Verbose
and-Debug
is functionally different (in a bad way) than using a typical-*Action
parameter. Why? Because of their implementation.For example, this shows verbose output from
Import-Module
, which is expected:Unfortunately, so does this, which is unexpected:
Why would
Write-Verbose
be influenced by the-Verbose
common parameter in the calling scope, but notImport-Module
? Maybe there is something else going on here, but I believe that this would be corrected by deprecating-Verbose
and-Debug
without breaking existing functionality by defining them such that they work as shorthand for-VerboseAction Continue
and-DebugAction Continue
, as described above.