-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
Introduce a common parameter pattern for requesting undecorated / not-wrapped-in-helper-types output objects #7855
Comments
@mklement0 Could you please list all affected cmdlets (from the repo) in the description? |
@iSazonov: Do you mean additional cmdlets that could benefit from this pattern? |
Yes, it will help PowerShell Committee to review and approve if they see the full list. |
@mklement0 @iSazonov We've already reviewed this issue as part of #7715. The committee unanimously agreed that we are going to continue to use the existing pattern |
@BrucePay: #7715 was focused on paving the way for the pattern proposed here - and the feedback suggested that the larger pattern and benefit perhaps wasn't fully considered in the decision. Hence, this issue was opened, which focuses on the bigger picture.
The pattern proposed is here is clearly distinguishable in intent from what the - unfortunately named - With the proposed deprecation (without removal) of
The benefit is the pattern described in the initial post, for which we have concrete uses already. |
And, just to give a dying horse another wack:
In a very loose sense you can consider that reading the input "raw", but this loose sense:
|
OK, one more for the road: Note: The premise is that there is value in establishing a general pattern using a shared parameter name and in applying it to #7713 and perhaps #5797, among others.
It is an option to live with the loose definition of
By contrast:
|
It was. Sorry if that was unclear. |
Thanks, @BrucePay, but further clarification is needed: To quote @SteveL-MSFT's summary:
This tells me that the decision was entirely focused on rejecting the proposal to deprecate Aside from my obvious preference for this deprecation (without removal - I'll stop saying that now, consider it implied; "deemphasizing" is just too clunky), this proposal's gist is to introduce a general parameter pattern with a shared name - while my naming preference is clearly Committing to this pattern means the newly agreed-upon name should be used in #7713, #7537, and perhaps #5797, as well as going forward. By your own reasoning,
In other words, this issue:
If so, and everyone's happy with this What to name the new streaming line-by-line w/o annotations parameter for |
Y'know, thinking on that a bit, @mklement0, although it would be a more significant change... I would consider simply replacing the There's no need for an extra parameter; as has been noted in the associated issues at least once, So while old code would need to be updated to work properly with the new version (thus a breaking change, I suppose), new code would be relatively backwards compatible, if the read-all-at-once was all that it was being used for. And if the undecorated output was required, it would be restricted to the newer versions. |
@vexx32: Actually, what There's no functional problem with naming the new parameter for reading lines undecorated (but still line-by-line) As an aside: Somewhat ironically, the only parameter that ever deserved to be called With my proposal, there would be no more (non-obsolete, non-deprecated) That said, there's no reason not to revive it where appropriate, given that, despite
There, I feel better now, although you could ask: hasn't that poor equine suffered enough? |
If this proposal or some variant of it were to go ahead then I would suggest this as a general pattern:
It would make it clear at a glance to the casual user that there are options to affect the output of the cmdlet and that there is a choice between a set of distinct modes. If I came across a future EDIT: OK, I see now that that |
@dgc: While Note that there's no need to distinguish between The partitioning aspect, which is not common, is covered in
|
@dgc: To reframe my previous comment in light of the decision that The need for the |
I went exploring, and maybe irrelevant but for the record, found a few other more things which, if you squint a bit, fit this issue's described pattern of asking a cmdlet to return a more basic output, or switch to another commonly desired output, or do less work for improved performance. Not all related to "undecorated" output, exactly:
and existing in Windows PowerShell, but not PS 6.1:
|
Currently we don't use Win32_PingStatus - please update your message. |
@iSazonov updated. |
Thanks, @HumanEquivalentUnit. The patterns I see in your examples is to ask for an alternative output data type or only part of the usual output objects. With respect to an alternative data type, it is what the You could argue that Similarly,
|
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
Follow-up from #7715; related to #7713, #7537, and #5797.
A pattern is emerging for asking cmdlets to output "bare" objects, which means output objects that:
are not decorated with
NoteProperty
members, the way lines read from a file withGet-Content
are, for instance.are not wrapped in instances of a helper type, the way that
Select-String
orCompare-Object
output is, for instance.There are three, not mutually exclusive motivations for requesting such "bare" output:
NoteProperty
members that subsequent processing may act on in an undesired fashion (see ConvertTo-Json: unexpected behavior with objects that have ETS properties (NoteProperty, ScriptProperty) #5797)There are probably more existing cmdlets that could benefit from the pattern, as would future ones.
In line with PowerShell's commitment to consistency, a common (shared) parameter name should be used in all these cases.
-Bare
makes the most sense to me.To avoid confusion with
-Raw
as implemented inGet-Content
- which simply reads the whole file while still decorating the resulting string - #7715 proposed deprecating-Raw
in favor of a more descriptive name such as-Whole
. (Note that by deprecating I don't mean to imply removing support for-Raw
, just documenting-Whole
first and mentioning-Raw
as a legacy name).Environment data
Written as of:
The text was updated successfully, but these errors were encountered: