You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cross platform pager using Microsoft.PowerShell.Pager #13405
We recently released a cross platform pager as a NuGet package Microsoft.PowerShell.Pager. The intention is to use the Pager for Get-Help and dynamic help.
The has been interest expressed in utilizing the Pager in a more general purpose way.
This issue is to discuss if the Pager should be distributed in some other form. Options on top of my mind in no priority order.
Built-in function or Cmdlet to use as a Pager
Something like, no intention of designing the cmdlet surface here.
Get-Process|Out-Pager
.NET global tool or Executable
The behavior will be similar to a native pager like less or more.com.
Personally, I think an Out-Pager cmdlet would be the most useful. If we can mimic some of the typical options from more or less as parmeters that'd be ideal, of course. IIRC there are some open issues around Out-Host -Paging that we should probably seek to fix for a new native pager implementation like this / ensure they aren't an issue in the new implementation.
Reacted by Patrick Meinecke, Ilya, Aditya Patwardhan and Colin Svingen
A big part of the draw imo is halting the pipeline. Even with how janky Out-Host -Paging is I still use it when I'm looking through results that are expensive to pull all at once. Being able to pause downstream ProcessRecord invocations when the screen fills up is great.
Reacted by Rain Sallow (/u/ta11ow), Ilya and Joel Bennett
I wanna throw out that regardless of what route we take here, I want to see the new pager replace the pager used in Out-Host -Paging (which we can't take out). We should only have one pager in the product :)
Reacted by Rain Sallow (/u/ta11ow), Stéphane BARIZIEN, Joel Bennett, lukeb1961, James O'Neill, Thomas Nieto and Colin Svingen
I wanna throw out that regardless of what route we take here, I want to see the new pager replace the pager used in Out-Host -Paging (which we can't take out). We should only have one pager in the product :)
In all my years using PowerShell I don't think I've used Out-host -paging - I learned | more - in about 1983 - and that's too much muscle memory to overturn (same applies to | clip or ping )
Windows PowerShell has more as a function wrapping for more.com and 7 just lets things flow through to the OS's more and a linux user might well use less
Having just tested it , I can't imagine anyone who just wanted paging would | Out-host -paging unless they had never heard of more , writing an error to say you pressed Q... I can, sort of, see that there may some case where you want to know the user didn't look at everything but the muscle memory which says press ctrl+c defeats it.
A big part of the draw imo is halting the pipeline. Even with how janky Out-Host -Paging is I still use it when I'm looking through results that are expensive to pull all at once. Being able to pause downstream ProcessRecord invocations when the screen fills up is great.
Even that is six of one and half a dozen of the other
try
1..1000 | %{ $_ ; sleep .2} | more
At one screenful you pause for a look, and then hit space for the next screenful and it's buffered and waiting. Downside ? Exiting with Q means waiting for the remaining rows; it needs ctrl + C 1..1000 | %{ $_ ; sleep .2} | out-host -Paging
Puts the brakes on; My hunch is most of the time, most people will want the machine to do the next part in the background while they're reviewing what has been done so far. But some of the people, some of the time will want "Don't do 51-100 until I have reviewed 1-50". I'm trying to think of a case where I'd stop after a screenful not review each item - at least for the first few items.
Having just tested it , I can't imagine anyone who just wanted paging would | Out-host -paging unless they had never heard of more , writing an error to say you pressed Q... I can, sort of, see that there may some case where you want to know the user didn't look at everything but the muscle memory which says press ctrl+c defeats it.
Yeah it's pretty terrible, but that's why we're talking about improving it.
At one screenful you pause for a look, and then hit space for the next screenful and it's buffered and waiting. Downside ? Exiting with Q means waiting for the remaining rows; it needs ctrl + C
Nah it can throw PipelineStoppedException.
My hunch is most of the time, most people will want the machine to do the next part in the background while they're reviewing what has been done so far.
Often retrieving a single page is quite quick while retrieving the entire result set is still expensive. Personally I have the opposite experience, the amount of times I'd have preferred the behavior you described is very rare.
I'm trying to think of a case where I'd stop after a screenful not review each item - at least for the first few items.
Often when exploring something interactively that returns a lot of results, you can tell whether you need to change your search criteria based on the first page. Also if you're fishing for a specific item with broad search criteria, you would want to stop processing the search once you spot what you're looking for.
@PowerShell/powershell-committee discussed this today and advises:
This feature needs to be wrapped as an experimental feature as we have open questions about the design. This is needed for 7.1. Everything else below is 7.2+
We agree that Out-Pager cmdlet makes sense as Out-Host -Paging is not discoverable
We agree that in cases where you have data, then paging should occur in the main screen buffer while deliberate use of Out-Pager (or dynamic help in PSReadLine) should use the alternate screen buffer
It may make sense to have paging as a common feature, but did not agree on whether it's a common parameter or some other configuration/preference set by the user
We agree that Out-Pager cmdlet makes sense as Out-Host -Paging is not discoverable
It is worth asking the question, why would a user prefer|Out-Pagerover|more. ?
To give a parallel Test-NetConnection has not replaced ping for most use cases because (1) We already know ping, as a universal command so the new command needs to overturn a habit. (2) most of the time we don't need to process objects returned - we don't achieve benefit from changing, and (3) At 18 characters instead of 4 it doesn't offer convenience.
Another parallel is | clip, which I use most days. Windows PowerShell (in V4 or V5) introduced a functionally identical Set-Clipboard which is more typing for something doesn't work everywhere- | clip.exe works in bash on Windows, cmd, and legacy PowerShell (which I still have to work with)
I'm not saying no one will ever prefer it, but before embarking on doing something because it's possible, there needs to be clarity on where it offers a gain (and where it doesn't try to), to justify using effort which could deliver something else. It can't be universal, something already does the job, so in what way is this doing the job better?
It may make sense to have paging as a common feature, but did not agree on whether it's a common parameter or some other configuration/preference set by the user
Think very, very, very hard about introducing Do-not-return-objects-but-print-text options. Some commands do exist to put stuff onthe console for a human to read (format-table, Get-Help) and their objects are seldom exploited.
But the thinking which says "-Paged would be a good common parameter" would also say "-AsTable , -AsList and -AsStrings would be good parameters" and is countered by the same logic which says no, use format-Table , format-list , or out-string
And again ask the question if / how / when -paged gives a better solution than |more.
James O'Neill (@jhoneill) the new pager and Out-Host -Paging pager work in a PSReadLine keyhandler. more/less do not. The intention is to use this pager for dynamic help feature in PSRL.
TylerLeonhardt
PSRL might be sufficient justification for doing a native pager - meaning PS users, generally speaking, not using it doesn't matter much. Improving the pager in out-host makes sense, Wrapping that in a PAGE function (any name <= 4 chars), makes more sense to me than adding a cmdlet to do the same job.
My call to avoid -DoNotReturnObjectsButPrintText common parameters stands though.
more only works if that pager is available in the system, from what I can see. It's not provided by PowerShell. Is it usually available? Sure. Always? 🤷
Every Microsoft operating system (certainly from DOS 3.1, including OS/2, NT3.1 and upwards, and Windows 9x) and every Unix based operating system from when I first used it in 1985, has supported |more and I've never seen it removed from a system. Any computer I've met which uses | supports more.
And if you're working in different shells, remembering a slightly different pager command is the least of one's concerns, surely. 😂
It's not the least but one of many small concerns. Don't worry about is test-netconnection, / Get-LocalGroupMember / Set-clipboard valid here when Ping, net localgroup or clip do the job. Just like they did 20 years ago. There are cases where you want the Ping objects, or GroupMember objects, but for clipboard or more, where's the benefit.
And even if you forget, as you pointed out, | more would still work in the majority of cases, so you're not losing out there either.
My point is not forgetting. It's non-adoption.
One other point (regarding the -Pager switch in Get-Help): we have "always" had a help function which is just a proxy for Get-Help @PSBoundParameters | more. In my opinion, that's the right way to deliver paging to help -- except that it should respect an environment variable for which pager to use!
We shouldn't be putting custom unique paging functionality into commands, because I want to use the pager which is the best, every time I use a pager (and that might not be your pager, but if you make it handle additional streams, it probably will be).
Hmm. A pager implementation could be made to format non-output streams according to their typical standard formatting, though, since non-output streams have their own discrete types.
This could be handled similar to how Out-Null is currently implemented. During PipelineProcessor init it can check if the downstream command is Out-Pager. If it is then do MergeMyResults(PipelineResultTypes.All, PipelineResultTypes.Output)
Downside is that it might change the order of some things due to the table formatters delay, though the displayed order would be more "correct".
It's not the least but one of many small concerns. Don't worry about is test-netconnection, / Get-LocalGroupMember / Set-clipboard valid here when Ping, net localgroup or clip do the job. Just like they did 20 years ago. There are cases where you want the Ping objects, or GroupMember objects, but for clipboard or more, where's the benefit.
For clip I recently forced myself to start using scb because of extra new line characters and encoding issues. ping is sort of a loaded scenario because it Test-Connection was pretty wonk for some time (ty Rain Sallow (/u/ta11ow) (@vexx32) for fixing it).
Reacted by Rain Sallow (/u/ta11ow) and Joel Bennett
Also all the talk about how native more/less variants are better but none of those work over remoting still right? It's still just Out-Host -Paging that works?
Reacted by TylerLeonhardt and Rain Sallow (/u/ta11ow)
For clarity - I should move from using clip.exe to using set-clipboard because of things like 2-byte characters but decades of muscle memory means I'll probably always use | clip so giving myself an alias would be a smart thing . PowerShell out-of-the-box seizing an existing name is a much less smart thing :-)
microsoft-github-policy-service commented on Nov 16, 2023
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.
microsoft-github-policy-service commented on Nov 16, 2023
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.
microsoft-github-policy-service commented on Nov 16, 2023
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.
Activity
vexx32 commentedon Aug 12, 2020
Personally, I think an
Out-Pagercmdlet would be the most useful. If we can mimic some of the typical options frommoreorlessas parmeters that'd be ideal, of course. IIRC there are some open issues around Out-Host -Paging that we should probably seek to fix for a new native pager implementation like this / ensure they aren't an issue in the new implementation.SeeminglyScience commentedon Aug 12, 2020
A big part of the draw imo is halting the pipeline. Even with how janky
Out-Host -Pagingis I still use it when I'm looking through results that are expensive to pull all at once. Being able to pause downstreamProcessRecordinvocations when the screen fills up is great.adityapatwardhan commentedon Aug 18, 2020
More feedback from Joel Bennett (@Jaykul) Rain Sallow (/u/ta11ow) (@vexx32) James O'Neill (@jhoneill) in issue #13468
TylerLeonhardt commentedon Aug 18, 2020
I wanna throw out that regardless of what route we take here, I want to see the new pager replace the pager used in
Out-Host -Paging(which we can't take out). We should only have one pager in the product :)iSazonov commentedon Aug 19, 2020
I guess there are users who will prefer Unix
less. I hope we preserve the environment variable to pick up a preferred pager.iSazonov commentedon Aug 19, 2020
-Pagerswitch in cmdlets.So my preference - only implement Out-Pager/Out-HostPager in 7.1 and then wait more feedback.
jhoneill commentedon Aug 19, 2020
In all my years using PowerShell I don't think I've used
Out-host -paging- I learned| more- in about 1983 - and that's too much muscle memory to overturn (same applies to| cliporping)Windows PowerShell has
moreas a function wrapping formore.comand 7 just lets things flow through to the OS'smoreand a linux user might well uselessHaving just tested it , I can't imagine anyone who just wanted paging would
| Out-host -pagingunless they had never heard ofmore, writing an error to say you pressed Q... I can, sort of, see that there may some case where you want to know the user didn't look at everything but the muscle memory which says press ctrl+c defeats it.Even that is six of one and half a dozen of the other
At one screenful you pause for a look, and then hit space for the next screenful and it's buffered and waiting. Downside ? Exiting with Q means waiting for the remaining rows; it needs ctrl + C
1..1000 | %{ $_ ; sleep .2} | out-host -PagingPuts the brakes on; My hunch is most of the time, most people will want the machine to do the next part in the background while they're reviewing what has been done so far. But some of the people, some of the time will want "Don't do 51-100 until I have reviewed 1-50". I'm trying to think of a case where I'd stop after a screenful not review each item - at least for the first few items.
SeeminglyScience commentedon Aug 19, 2020
Yeah it's pretty terrible, but that's why we're talking about improving it.
Nah it can throw
PipelineStoppedException.Often retrieving a single page is quite quick while retrieving the entire result set is still expensive. Personally I have the opposite experience, the amount of times I'd have preferred the behavior you described is very rare.
Often when exploring something interactively that returns a lot of results, you can tell whether you need to change your search criteria based on the first page. Also if you're fishing for a specific item with broad search criteria, you would want to stop processing the search once you spot what you're looking for.
SteveL-MSFT commentedon Aug 19, 2020
@PowerShell/powershell-committee discussed this today and advises:
Out-Pagercmdlet makes sense asOut-Host -Pagingis not discoverableOut-Pager(or dynamic help in PSReadLine) should use the alternate screen bufferTylerLeonhardt commentedon Aug 19, 2020
Steve Lee (@SteveL-MSFT) did the committee also say that
Out-Host -Pagingshould use the new pager?jhoneill commentedon Aug 20, 2020
Steve Lee (@SteveL-MSFT)
It is worth asking the question, why would a user prefer
|Out-Pagerover|more. ?To give a parallel
Test-NetConnectionhas not replacedpingfor most use cases because (1) We already knowping, as a universal command so the new command needs to overturn a habit. (2) most of the time we don't need to process objects returned - we don't achieve benefit from changing, and (3) At 18 characters instead of 4 it doesn't offer convenience.Another parallel is
| clip, which I use most days. Windows PowerShell (in V4 or V5) introduced a functionally identicalSet-Clipboardwhich is more typing for something doesn't work everywhere-| clip.exeworks in bash on Windows, cmd, and legacy PowerShell (which I still have to work with)I'm not saying no one will ever prefer it, but before embarking on doing something because it's possible, there needs to be clarity on where it offers a gain (and where it doesn't try to), to justify using effort which could deliver something else. It can't be universal, something already does the job, so in what way is this doing the job better?
Think very, very, very hard about introducing
Do-not-return-objects-but-print-textoptions. Some commands do exist to put stuff onthe console for a human to read (format-table,Get-Help) and their objects are seldom exploited.But the thinking which says "
-Pagedwould be a good common parameter" would also say "-AsTable,-AsListand-AsStringswould be good parameters" and is countered by the same logic which says no, useformat-Table,format-list, orout-stringAnd again ask the question if / how / when
-pagedgives a better solution than|more.TylerLeonhardt commentedon Aug 20, 2020
James O'Neill (@jhoneill) the new pager and
Out-Host -Pagingpager work in a PSReadLine keyhandler. more/less do not. The intention is to use this pager for dynamic help feature in PSRL.jhoneill commentedon Aug 20, 2020
TylerLeonhardt
PSRL might be sufficient justification for doing a native pager - meaning PS users, generally speaking, not using it doesn't matter much. Improving the pager in
out-hostmakes sense, Wrapping that in a PAGE function (any name <= 4 chars), makes more sense to me than adding a cmdlet to do the same job.My call to avoid
-DoNotReturnObjectsButPrintTextcommon parameters stands though.7 remaining items
jhoneill commentedon Aug 21, 2020
Every Microsoft operating system (certainly from DOS 3.1, including OS/2, NT3.1 and upwards, and Windows 9x) and every Unix based operating system from when I first used it in 1985, has supported |more and I've never seen it removed from a system. Any computer I've met which uses | supports more.
It's not the least but one of many small concerns. Don't worry about is
test-netconnection, /Get-LocalGroupMember/Set-clipboardvalid here when Ping, net localgroup or clip do the job. Just like they did 20 years ago. There are cases where you want the Ping objects, or GroupMember objects, but for clipboard or more, where's the benefit.Jaykul commentedon Aug 21, 2020
One other point (regarding the
-Pagerswitch in Get-Help): we have "always" had ahelpfunction which is just a proxy forGet-Help @PSBoundParameters | more. In my opinion, that's the right way to deliver paging to help -- except that it should respect an environment variable for which pager to use!We shouldn't be putting custom unique paging functionality into commands, because I want to use the pager which is the best, every time I use a pager (and that might not be your pager, but if you make it handle additional streams, it probably will be).
SeeminglyScience commentedon Aug 21, 2020
This could be handled similar to how
Out-Nullis currently implemented. DuringPipelineProcessorinit it can check if the downstream command isOut-Pager. If it is then doMergeMyResults(PipelineResultTypes.All, PipelineResultTypes.Output)Downside is that it might change the order of some things due to the table formatters delay, though the displayed order would be more "correct".
For
clipI recently forced myself to start usingscbbecause of extra new line characters and encoding issues.pingis sort of a loaded scenario because itTest-Connectionwas pretty wonk for some time (ty Rain Sallow (/u/ta11ow) (@vexx32) for fixing it).SeeminglyScience commentedon Aug 21, 2020
Also all the talk about how native
more/lessvariants are better but none of those work over remoting still right? It's still justOut-Host -Pagingthat works?Swoogan commentedon Aug 13, 2022
James O'Neill (@jhoneill)
Today I discovered a case where
|moredoesn't work as I would expect:Which, in turn, affects long lines that have been truncated with the ellipsis (the line gets wrapped with
Ǫappearing on the next line.jhoneill commentedon Aug 13, 2022
Colin Svingen (@Swoogan) yes, if you pipe a 2byte character - like ellipsis - to a command-like app it becomes two 1byte characters.
"…" | clipDoes the same thing.
But
"…" | Set-Clipboardworks. But I use| clip99% of time ,even thoughGet-Clipboardshould lead me to usingSet-Clipboard.Really the smart thing to do with
set-clipboardorout-pageris to alias them toclip/moreSteveL-MSFT commentedon Aug 15, 2022
Aliasing over existing executables tend to break people.
jhoneill commentedon Aug 15, 2022
For clarity - I should move from using clip.exe to using
set-clipboardbecause of things like 2-byte characters but decades of muscle memory means I'll probably always use| clipso giving myself an alias would be a smart thing . PowerShell out-of-the-box seizing an existing name is a much less smart thing :-)microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.