Server Man
Well-Known Member
- May 17, 2015
- Android
- Android browser 4.0
Yes. This is yet another post about GridViews. We love them. You love them. What’s not to like?
If you’re not familiar with Out-GridView, it can be used to interactively view objects as a table allowing sorting and filtering. Many PowerShell users like to use it within a pipeline for interactive selection of objects that get processed later in the pipeline.
Let’s recap where we’re at with respect to GridViews:
Today, I have the exciting opportunity to talk about a new GridView.
Introducing the Microsoft.PowerShell.ConsoleGuiTools module now in Preview
The Microsoft.PowerShell.ConsoleGuiTools is a module that will contain a set of cmdlets that enable console-based GUIs. Today, it contains one very important cmdlet: Out-ConsoleGridView.
Get-Process | Out-ConsoleGridView
This shows up right in the same console window you were using without launching any outside process. This module leverages the incredibly powerful and cross-platform gui.cs library by Miguel de Icaza.
Oh yeah, it also supports -PassThru!
Get-ChildItem | Out-ConsoleGridView -PassThru
View attachment 3165612d386164612d3833653761373363306433632e676966.gif
In that last gif, you might have also noticed that mouse clicks work in the Actions menu!
Installation
If you want to get this right now:
Install-Module Microsoft.PowerShell.ConsoleGuiTools
Features
PassThru
One of the most powerful features, the -PassThru parameter lets you use the GUI to select data to send further down the pipeline.
Get-Process | Out-GridView -PassThru | Stop-Process
If you were so inclined the above script uses -PassThru to create a pretty effective emulation of a Process Manger.
Mouse clicks and keyboard support
You can click on the actions menu, dialogs and grid view using your mouse.
You can also use your keyboard:
Since the Console GUIs (or CUIs) in Microsoft.PowerShell.ConsoleGuiTools show up in the same console you’re prompt is in, support for environments that don’t supply a GUI but have a terminal emulators, like Azure Cloud Shell, work out of the box.
In fact, the gif in this very blog post was recorded in Azure Cloud Shell!
This is Microsoft.PowerShell.ConsoleGuiTools differentiating feature to other Out-GridViews. It’s a GUI tool, without needing a GUI.
Install it in Cloud Shell and let us know what you think!
Limitations
Currently, the Microsoft.PowerShell.ConsoleGuiTools module works only on macOS and Linux due to a known gui.cs issue on Windows.
Since Windows has multiple other options for GridView’s we felt that this was a reasonable limitation for now.
The Future
The Microsoft.PowerShell.ConsoleGuiTools module is still in preview. We’re looking for your feedback to make sure we’re on the right track for supporting this. Please don’t hesitate to open issues and feature requests over in the GraphicalTools repo which is home to both the Microsoft.PowerShell.GraphicalTools module and the Microsoft.PowerShell.ConsoleGuiTools module.
We are looking for a community member to help port Show-Command and Show-Object to ConsoleGuiTools. Check out the repository and post in the issue tracking Show-Command if you’re interested.
With the majority of the brunt work integrating PowerShell & gui.cs done, we are also open to submissions for new graphical commands or packages.
The post A new kind of GridView right in your console: Introducing the early preview of ConsoleGuiTools appeared first on PowerShell.
Continue reading...
If you’re not familiar with Out-GridView, it can be used to interactively view objects as a table allowing sorting and filtering. Many PowerShell users like to use it within a pipeline for interactive selection of objects that get processed later in the pipeline.
Let’s recap where we’re at with respect to GridViews:
- PowerShell 7 (which GA’d recently!) brought back the old WinForm-based Out-GridView from Windows PowerShell.
- We released the Microsoft.PowerShell.GraphicalTools module which provided a cross-platform (Windows, macOS & Linux) Out-GridView cmdlet based on AvaloniaUI.
- Community members have also implemented both cross-platform and native solutions for providing an Out-GridView functionality on macOS and Linux.
Today, I have the exciting opportunity to talk about a new GridView.
Introducing the Microsoft.PowerShell.ConsoleGuiTools module now in Preview
The Microsoft.PowerShell.ConsoleGuiTools is a module that will contain a set of cmdlets that enable console-based GUIs. Today, it contains one very important cmdlet: Out-ConsoleGridView.
Get-Process | Out-ConsoleGridView
This shows up right in the same console window you were using without launching any outside process. This module leverages the incredibly powerful and cross-platform gui.cs library by Miguel de Icaza.
Oh yeah, it also supports -PassThru!
Get-ChildItem | Out-ConsoleGridView -PassThru
View attachment 3165612d386164612d3833653761373363306433632e676966.gif
In that last gif, you might have also noticed that mouse clicks work in the Actions menu!
Installation
If you want to get this right now:
Install-Module Microsoft.PowerShell.ConsoleGuiTools
Features
PassThru
One of the most powerful features, the -PassThru parameter lets you use the GUI to select data to send further down the pipeline.
Get-Process | Out-GridView -PassThru | Stop-Process
If you were so inclined the above script uses -PassThru to create a pretty effective emulation of a Process Manger.
Mouse clicks and keyboard support
You can click on the actions menu, dialogs and grid view using your mouse.
You can also use your keyboard:
- Spacebar: marks one of the items in the grid view with an x if you used the PassThru parameter
- F9: opens the Action menu
- ESC: closes the Action menu
- Arrow keys: move around
- ENTER: Choose an Action or answer a dialog
Azure Cloud Shell supportNOTE: At this time you can’t mark items in the grid view with mouse click. That will be available in the next version of gui.cs which will likely be the next version of ConsoleGuiTools
Since the Console GUIs (or CUIs) in Microsoft.PowerShell.ConsoleGuiTools show up in the same console you’re prompt is in, support for environments that don’t supply a GUI but have a terminal emulators, like Azure Cloud Shell, work out of the box.
In fact, the gif in this very blog post was recorded in Azure Cloud Shell!
This is Microsoft.PowerShell.ConsoleGuiTools differentiating feature to other Out-GridViews. It’s a GUI tool, without needing a GUI.
Install it in Cloud Shell and let us know what you think!
Limitations
Currently, the Microsoft.PowerShell.ConsoleGuiTools module works only on macOS and Linux due to a known gui.cs issue on Windows.
Since Windows has multiple other options for GridView’s we felt that this was a reasonable limitation for now.
The Future
The Microsoft.PowerShell.ConsoleGuiTools module is still in preview. We’re looking for your feedback to make sure we’re on the right track for supporting this. Please don’t hesitate to open issues and feature requests over in the GraphicalTools repo which is home to both the Microsoft.PowerShell.GraphicalTools module and the Microsoft.PowerShell.ConsoleGuiTools module.
We are looking for a community member to help port Show-Command and Show-Object to ConsoleGuiTools. Check out the repository and post in the issue tracking Show-Command if you’re interested.
With the majority of the brunt work integrating PowerShell & gui.cs done, we are also open to submissions for new graphical commands or packages.
The post A new kind of GridView right in your console: Introducing the early preview of ConsoleGuiTools appeared first on PowerShell.
Continue reading...