Skip to content
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

Changes F7 sample to use Out-ConsoleGridView #3435

Closed
wants to merge 1 commit into from

Conversation

tig
Copy link

@tig tig commented Sep 15, 2022

PR Summary

Updates the PSReadLine sample code to use Out-ConsoleGridView instead of the defunct (and not cross platform) Out-GridView.

Note that the old sample supported multi-select and the F7History.ps1 sample does not. It is possible to modify it to support multi-select, but doing so exposes a big question:

  • In what order should the selected history items be executed. Neither Out-GridView or Out-ConsoleGridView support a way for the user to determine this.

PR Checklist

  • [ X] PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • [ X] Summarized changes
  • Make sure you've added one or more new tests
  • [ X] Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
    • OR
    • [] Documentation needed at PowerShell-Docs
      • Doc Issue filed:
Microsoft Reviewers: Open in CodeFlow

@SteveL-MSFT SteveL-MSFT reopened this Feb 17, 2023
@daxian-dbw
Copy link
Member

As a sample, the benefit of using Out-GridView is that it's available by default. While for Out-ConsoleGridView, it requires a user to install that module first. So, for the purpose of a sample, we should continue to use Out-GridView here.

However, if you can publish your handler script that uses Out-ConsoleGridView as a gist, we may be able to point to it in the comment of the F7 example.

@daxian-dbw daxian-dbw closed this Aug 14, 2023
@tig
Copy link
Author

tig commented Aug 15, 2023

As a sample, the benefit of using Out-GridView is that it's available by default. While for Out-ConsoleGridView, it requires a user to install that module first. So, for the purpose of a sample, we should continue to use Out-GridView here.

However, if you can publish your handler script that uses Out-ConsoleGridView as a gist, we may be able to point to it in the comment of the F7 example.

Ok, but two points that might influence you:

  1. Out-GridView only works on Windows and Mac. Not Linux.
  2. Out-GridView is deprecated by Microsoft.

@daxian-dbw
Copy link
Member

I'm not aware that Out-GridView is to be deprecated. But you are right on the 1st point. So, if you can publish the "F7 with Out-ConsoleGridView" gist, we can consider point to it in the sample.

@tig
Copy link
Author

tig commented Aug 15, 2023

I forgot to mention: I've recently packaged F7History up as a PowerShell Gallery-installable module:

https://github.com/gui-cs/F7History/

With this, perhaps this PR is really about just pointing to the F7History repo as a good example?

Install F7History from the PowerShell Gallery.

Install-Module -Name "F7History"

Add a line to import F7History in your PowerShell $profile:

Import-Module -Name "F7History"

To change the key bindings, use the -ArgumentList parameter when importing the module. For example, to use F6 and Shift-F6 instead of F7 and Shift-F7:

Import-Module -Name "F7History" -ArgumentList  @{Key = "F6"; AllKey = "Shift-F6"}

@daxian-dbw
Copy link
Member

The comment of the F7 sample was updated to point to the F7History module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants