Skip to content

Please leave paging in the pager #13468

Closed

Description

@Jaykul

There really should not be any commands with a switch like -Paged or -Paging except Out-Host

Granted, the -Paging switch on Out-Host needs improvement, but we definitely do not want that better implementation to come on some other command! That would just be confusing!

Some thoughts regarding Get-Help -Paged that seem obvious, but which don't appear to have been address. (I'll admit I've been off in la-la land for awhile, but I'm reasonably sure there's no RFC, and I can't find anywhere else this has been discussed).

  1. To help new users (by making the help more usable), we should do so in a manner that's consistent with how the rest of PowerShell works, rather than breaking the PowerShell output model by having a Get command swap to another output buffer instead of streaming output. Maybe you meant to write a Show-Help command?
  2. To improve paging in PowerShell, we should improve Out-Host -Paging. It's terribly minimal right now, and I doubt anyone uses it in lieu of more or most or less except in very locked-down environments.
  3. To avoid needing to write | oh -pa (or | Out-Host -Paging) we should create a way to provide hints to the default host output that we want paging, rather than build a whole new pager into the Help command. Perhaps a magic property on the object, or an ANSI sequence (or something) that Out-Host could pick up on -- something that any command could set to trigger the behavior. If we did that, maybe we could even make -Paged a common parameter...

Activity

  1. vexx32 commented on Aug 18, 2020

    @vexx32
    Collaborator

    Fully agreed. Though IMO a separate Out-Pager command is fine if we want an easier/more discoverable way to expose more advanced features / customisation options of the pager.

  2. jhoneill commented on Aug 18, 2020

    @jhoneill

    TLDR YES to what Joel Bennett (@Jaykul) said. There's a working standardized way already, a new way would only add novelty, is no more convenient and in some cases makes things worse.

    In Detail:

    1. Pagination using | more was set as the norm in the 1970s, it was incorporated in the first versions of MS-DOS and has carried through to the present day. Better paginators have been created (e.g. less). Some commands will always want | paginator

    2. Adding -Paged to the end of command does not save anything over typing |more. To pre-empt "Golf" practitioners, where --p is unique that can be used, but it won't always be valid, however one can make p and alias for one's preferred paginator and |p will always be valid

    3. I can see some superficial attraction, to adding -Paged as a common parameter handled outside a cmdlet or function. We do it for error action, variables etc, so why not? Because it blurs a distinction that goes right back to the monad manifesto: Output and Printing to the console are not the same thing: it's a founding principle that getting stuff, processing stuff, and printing stuff nicely (for some arbitrary value of 'nice') are distinct activities.
      The reason there isn't and shouldn't be a pagination switch for getting or processing commands is the same reason there aren't -List or -Table parameters : things to shift from outputting objects into the pipeline , towards printing strings on a terminal (including marking up data for display in colour) should be in their own commands at the end of a pipeline or in the default formatting data used when the object has nowhere to go but the console.

    4. It's quite common for a command to evolve
      dir -Recurse -Pat~\Pictures\ -include o*
      then
      dir -Recurse -Pa ~\Pictures\ -include o* | sort extension
      then
      dir -Recurse -Pa ~\Pictures\ -include o* | where length -gt 10mb | sort extension
      Ignoring page breaking the short form of path, would this work correctly, or would he page switch be walked down the pipeline as it grows?
      dir -Recurse -Page -Path ~\Pictures\ -include o* | sort extension

  3. adityapatwardhan commented on Aug 18, 2020

    @adityapatwardhan
    Member

    All the feedback here is highly appreciated! I have already started a issue to collect feedback for Pager here: #13405

    I have linked these two issues. The idea was to be a conversation starter and Get-Help -Paged is not set in stone.

  4. iSazonov commented on Aug 19, 2020

    @iSazonov
    Collaborator

    Let's discuss only in #13405

  5. ghost closed this as completedon Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-DuplicateThe issue is a duplicate.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions