Get-Event -Descending/-First #20444
Labels
In-PR
Indicates that a PR is out for the issue
Issue-Enhancement
the issue is more of a feature request than a bug
Needs-Triage
The issue is new and needs to be triaged by a work group.
WG-Cmdlets-Utility
cmdlets in the Microsoft.PowerShell.Utility module
WG-NeedsReview
Needs a review by the labeled Working Group
Summary of the new feature / enhancement
Events are currently a queue. Due to backwards compatibility, this cannot be changed.
However, it's the less common of the two use cases.
In nearly every interactive scenario, one needs to get the most recent event and act upon it.
A good example of this is finding the most recent change from a websocket.
The websocket will broadcast events back indicating a change. Using Get-Event at present, one needs to get the whole list of events and pick off the end.
Proposed technical implementation details (optional)
Get-Event should include a -Descending parameter (possibly aliased to -Stack), which would return the most recent event first. Also add SupportsPagination to the cmdlet so be able to get the -First n results and -Skip a number of items.
The text was updated successfully, but these errors were encountered: